Created
November 22, 2018 14:58
-
-
Save pmiddend/de5015a18148687eed512868300b0e5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RankingSpec(spec) where | |
import Test.Hspec(describe, Spec) | |
import Test.Hspec.QuickCheck(prop) | |
import Test.QuickCheck(applyFun2, Fun) | |
import qualified Data.List.NonEmpty as NE | |
import Myocardio.Ranking(generateComplements) | |
import Test.QuickCheck.Instances.Semigroup | |
propType :: [a] -> Fun (a,NE.NonEmpty a) Int -> Bool | |
propType as f = length (generateComplements as (applyFun2 f)) == length as | |
spec :: Spec | |
spec = | |
describe "generate complements" $ | |
prop "should never change the number of list elements" propType | |
{- | |
test-suite/RankingSpec.hs:16:9: error: | |
• Ambiguous type variable ‘a0’ arising from a use of ‘prop’ | |
prevents the constraint ‘(Test.QuickCheck.Arbitrary.Arbitrary | |
a0)’ from being solved. | |
Probable fix: use a type annotation to specify what ‘a0’ should be. | |
These potential instances exist: | |
instance [safe] (Test.QuickCheck.Function.Function a, | |
Test.QuickCheck.Arbitrary.CoArbitrary a, | |
Test.QuickCheck.Arbitrary.Arbitrary b) => | |
Test.QuickCheck.Arbitrary.Arbitrary (Fun a b) | |
-- Defined in ‘Test.QuickCheck.Function’ | |
instance (Test.QuickCheck.Arbitrary.Arbitrary a, | |
Test.QuickCheck.Arbitrary.Arbitrary b) => | |
Test.QuickCheck.Arbitrary.Arbitrary (Either a b) | |
-- Defined in ‘Test.QuickCheck.Arbitrary’ | |
instance [safe] Test.QuickCheck.Arbitrary.Arbitrary a => | |
Test.QuickCheck.Arbitrary.Arbitrary (NE.NonEmpty a) | |
-- Defined in ‘Test.QuickCheck.Instances.Semigroup’ | |
...plus 21 others | |
...plus 75 instances involving out-of-scope types | |
(use -fprint-potential-instances to see them all) | |
• In a stmt of a 'do' block: | |
prop "should never change the number of list elements" propType | |
In the second argument of ‘($)’, namely | |
‘do prop | |
"should never change the number of list elements" propType’ | |
In the expression: | |
describe "generate complements" | |
$ do prop | |
"should never change the number of list elements" propType | |
| | |
16 | prop "should never change the number of list elements" propType | |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment