Skip to content

Instantly share code, notes, and snippets.

@jml
Created August 3, 2014 13:17
Show Gist options
  • Select an option

  • Save jml/25166ff19edc724a2964 to your computer and use it in GitHub Desktop.

Select an option

Save jml/25166ff19edc724a2964 to your computer and use it in GitHub Desktop.
Two very similar quickcheck properties
type Transformation a = (TodoFile -> a -> (TodoFile, [TodoEvent]))
-- XXX: If there were something that was like 'map f' but when given a
-- non-list would lift to a list and return a singleton, that would make this
-- more generic.
prop_emptyUnchanged_multiple :: Transformation [Int] -> Property
prop_emptyUnchanged_multiple transformation =
property $ \items -> transformation emptyFile items `shouldBe` (emptyFile, map NoSuchTask (nub items))
prop_emptyUnchanged_single :: Transformation Int -> Property
prop_emptyUnchanged_single transformation =
property $ \item -> transformation emptyFile item `shouldBe` (emptyFile, [NoSuchTask item])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment