Added QuickCheck generator and a test.