refactor tests

This commit is contained in:
Filip Gralinski 2015-11-06 22:02:01 +01:00 committed by Filip Gralinski
parent 17d39c4293
commit 570411b702

View File

@ -12,33 +12,18 @@ main = hspec $ do
it "simple test" $ do it "simple test" $ do
geval (defaultGEvalSpecification {gesExpectedDirectory=Just "test/rmse-simple/rmse-simple", gesOutDirectory="test/rmse-simple/rmse-simple-solution"}) `shouldReturnAlmost` 0.64549722436790 geval (defaultGEvalSpecification {gesExpectedDirectory=Just "test/rmse-simple/rmse-simple", gesOutDirectory="test/rmse-simple/rmse-simple-solution"}) `shouldReturnAlmost` 0.64549722436790
describe "mean square error" $ do describe "mean square error" $ do
it "simple test with arguments" $ do it "simple test with arguments" $
((runGEval ["--expected-directory", runGEvalTest "mse-simple" `shouldReturnAlmost` 0.4166666666666667
"test/mse-simple/mse-simple",
"--out-directory",
"test/mse-simple/mse-simple-solution"]) >>= extractVal) `shouldReturnAlmost` 0.4166666666666667
describe "BLEU" $ do describe "BLEU" $ do
it "trivial example from Wikipedia" $ do it "trivial example from Wikipedia" $
((runGEval ["--expected-directory", runGEvalTest "bleu-trivial" `shouldReturnAlmost` 0.0
"test/bleu-trivial/bleu-trivial", it "complex example" $
"--out-directory", runGEvalTest "bleu-complex" `shouldReturnAlmost` 0.6211
"test/bleu-trivial/bleu-trivial-solution"]) >>= extractVal) `shouldReturnAlmost` 0.0 it "perfect translation" $
it "complex example" $ do runGEvalTest "bleu-perfect" `shouldReturnAlmost` 1.0000
((runGEval ["--expected-directory",
"test/bleu-complex/bleu-complex",
"--out-directory",
"test/bleu-complex/bleu-complex-solution"]) >>= extractVal) `shouldReturnAlmost` 0.6211
it "perfect translation" $ do
((runGEval ["--expected-directory",
"test/bleu-perfect/bleu-perfect",
"--out-directory",
"test/bleu-perfect/bleu-perfect-solution"]) >>= extractVal) `shouldReturnAlmost` 1.0000
describe "Accuracy" $ do describe "Accuracy" $ do
it "simple example" $ do it "simple example" $
((runGEval ["--expected-directory", runGEvalTest "accuracy-simple" `shouldReturnAlmost` 0.6
"test/accuracy-simple/accuracy-simple",
"--out-directory",
"test/accuracy-simple/accuracy-simple-solution"]) >>= extractVal) `shouldReturnAlmost` 0.6
describe "precision count" $ do describe "precision count" $ do
it "simple test" $ do it "simple test" $ do
precisionCount [["Alice", "has", "a", "cat" ]] ["Ala", "has", "cat"] `shouldBe` 2 precisionCount [["Alice", "has", "a", "cat" ]] ["Ala", "has", "cat"] `shouldBe` 2