1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Use the sizing functions in TermSpec.

This commit is contained in:
Rob Rix 2016-06-06 12:26:06 -04:00
parent c173c38a6c
commit c9763c43ba

View File

@ -21,11 +21,11 @@ spec = parallel $ do
describe "ArbitraryTerm" $ describe "ArbitraryTerm" $
prop "generates terms of a specific size" $ forAll ((arbitrary >>= \ n -> (,) n <$> termOfSize n) `suchThat` ((> 0) . fst)) $ prop "generates terms of a specific size" $ forAll ((arbitrary >>= \ n -> (,) n <$> termOfSize n) `suchThat` ((> 0) . fst)) $
\ (n, term) -> cata (succ . sum) (toTerm (term :: ArbitraryTerm String ())) `shouldBe` n \ (n, term) -> arbitraryTermSize (term :: ArbitraryTerm String ()) `shouldBe` n
describe "ArbitraryDiff" $ describe "ArbitraryDiff" $
prop "generates diffs of a specific size" $ forAll ((arbitrary >>= \ n -> (,) n <$> diffOfSize n) `suchThat` ((> 0) . fst)) $ prop "generates diffs of a specific size" $ forAll ((arbitrary >>= \ n -> (,) n <$> diffOfSize n) `suchThat` ((> 0) . fst)) $
\ (n, diff) -> cata (succ . sum) (fmap (cata (succ . sum)) <$> (toDiff (diff :: ArbitraryDiff String ()))) `shouldBe` n \ (n, diff) -> arbitraryDiffSize (diff :: ArbitraryDiff String ()) `shouldBe` n
describe "Diff" $ do describe "Diff" $ do
prop "equality is reflexive" $ prop "equality is reflexive" $