diff --git a/test/Spec.hs b/test/Spec.hs index 49abfb9..8a727c0 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -364,6 +364,38 @@ main = hspec $ do runGEvalTest "f1-with-preprocessing" `shouldReturnAlmost` 0.57142857142857 it "Regexp substition" $ do runGEvalTest "accuracy-with-flags" `shouldReturnAlmost` 0.8 + it "In line-by-line mode" $ do + let sampleChallenge = GEvalSpecification + { gesOutDirectory = "test/accuracy-flags-line-by-line/accuracy-flags-line-by-line-solution", + gesExpectedDirectory = Just "test/accuracy-flags-line-by-line/accuracy-flags-line-by-line", + gesTestName = "test-A", + gesSelector = Nothing, + gesOutFile = "out.tsv", + gesAltOutFiles = Nothing, + gesExpectedFile = "expected.tsv", + gesInputFile = "in.tsv", + gesMetrics = [read "Accuracy:fs<\\d+><>"], + gesFormatting = FormattingOptions Nothing False, + gesTokenizer = Just Minimalistic, + gesGonitoHost = Nothing, + gesToken = Nothing, + gesGonitoGitAnnexRemote = Nothing, + gesReferences = Nothing, + gesBootstrapResampling = Nothing, + gesInHeader = Nothing, + gesOutHeader = Nothing } + results <- runLineByLineGeneralized KeepTheOriginalOrder sampleChallenge (const Data.Conduit.List.consume) + results `shouldBe` [ + LineRecord "foo" + "Ala 123 ma kota." + "Ala ma 2 kota ." + 1 + 1.0, + LineRecord "foo" + "Foo bar baz" + "Fox bax 456 bax" + 2 + 0.0] describe "Flag examples" $ do it "none" $ do runGEvalTest "flags-none" `shouldReturnAlmost` 0.2 diff --git a/test/accuracy-flags-line-by-line/accuracy-flags-line-by-line-solution/test-A/out.tsv b/test/accuracy-flags-line-by-line/accuracy-flags-line-by-line-solution/test-A/out.tsv new file mode 100644 index 0000000..e2687b8 --- /dev/null +++ b/test/accuracy-flags-line-by-line/accuracy-flags-line-by-line-solution/test-A/out.tsv @@ -0,0 +1,4 @@ +Ala ma 2 kota . +computer +Fox bax 456 bax +nothing diff --git a/test/accuracy-flags-line-by-line/accuracy-flags-line-by-line/test-A/expected.tsv b/test/accuracy-flags-line-by-line/accuracy-flags-line-by-line/test-A/expected.tsv new file mode 100644 index 0000000..b69e21b --- /dev/null +++ b/test/accuracy-flags-line-by-line/accuracy-flags-line-by-line/test-A/expected.tsv @@ -0,0 +1,4 @@ +Ala 123 ma kota. +computer +Foo bar baz +nothing diff --git a/test/accuracy-flags-line-by-line/accuracy-flags-line-by-line/test-A/in.tsv b/test/accuracy-flags-line-by-line/accuracy-flags-line-by-line/test-A/in.tsv new file mode 100644 index 0000000..8afabdb --- /dev/null +++ b/test/accuracy-flags-line-by-line/accuracy-flags-line-by-line/test-A/in.tsv @@ -0,0 +1,4 @@ +foo +bar +foo +baz