more tests
This commit is contained in:
parent
c3106a1ad6
commit
0835bc3a4e
12
test/Spec.hs
12
test/Spec.hs
@ -57,10 +57,22 @@ main = hspec $ do
|
||||
precision testMatchFun ['a', 'b', 'c'] [0, 1, 2, 3, 4, 5] `shouldBeAlmost` 0.3333333333333333
|
||||
recall testMatchFun ['a', 'b', 'c'] [0, 1, 2, 3, 4, 5] `shouldBeAlmost` 0.66666666666666666
|
||||
f1Measure testMatchFun ['a', 'b', 'c'] [0, 1, 2, 3, 4, 5] `shouldBeAlmost` 0.444444444444444
|
||||
it "perfect result" $ do
|
||||
precision alwaysMatch ['a', 'b', 'c'] [0, 1, 2] `shouldBeAlmost` 1.0
|
||||
recall alwaysMatch ['a', 'b', 'c'] [0, 1, 2] `shouldBeAlmost` 1.0
|
||||
f1Measure alwaysMatch ['a', 'b', 'c'] [0, 1, 2] `shouldBeAlmost` 1.0
|
||||
it "full match" $ do
|
||||
precision alwaysMatch ['a', 'b', 'c'] [0, 1, 2, 3, 4, 5] `shouldBeAlmost` 0.5
|
||||
recall alwaysMatch ['a', 'b', 'c'] [0, 1, 2, 3, 4, 5] `shouldBeAlmost` 1.0
|
||||
f1Measure alwaysMatch ['a', 'b', 'c'] [0, 1, 2, 3 , 4, 5] `shouldBeAlmost` 0.66666666666666
|
||||
|
||||
|
||||
neverMatch :: Char -> Int -> Bool
|
||||
neverMatch _ _ = False
|
||||
|
||||
alwaysMatch :: Char -> Int -> Bool
|
||||
alwaysMatch _ _ = True
|
||||
|
||||
testMatchFun :: Char -> Int -> Bool
|
||||
testMatchFun 'a' 1 = True
|
||||
testMatchFun 'a' 2 = True
|
||||
|
Loading…
Reference in New Issue
Block a user