add test for the line-by-line mode
This commit is contained in:
parent
cb655cd2ae
commit
f68223409e
@ -80,6 +80,7 @@ test-suite geval-test
|
||||
, text
|
||||
, attoparsec
|
||||
, edit-distance
|
||||
, conduit
|
||||
ghc-options: -threaded -rtsopts -with-rtsopts=-N
|
||||
default-language: Haskell2010
|
||||
|
||||
|
@ -11,7 +11,8 @@ module GEval.LineByLine
|
||||
(runLineByLine,
|
||||
runLineByLineGeneralized,
|
||||
runDiff,
|
||||
runDiffGeneralized
|
||||
runDiffGeneralized,
|
||||
LineRecord(..)
|
||||
) where
|
||||
|
||||
import GEval.Core
|
||||
|
21
test/Spec.hs
21
test/Spec.hs
@ -9,11 +9,14 @@ import GEval.ClippEU
|
||||
import GEval.PrecisionRecall
|
||||
import GEval.ClusteringMetrics
|
||||
import GEval.BIO
|
||||
import GEval.LineByLine
|
||||
import Data.Attoparsec.Text
|
||||
import Options.Applicative
|
||||
import Data.Text
|
||||
import Text.EditDistance
|
||||
|
||||
import Data.Conduit.List (consume)
|
||||
|
||||
import qualified Test.HUnit as HU
|
||||
|
||||
informationRetrievalBookExample :: [(String, Int)]
|
||||
@ -263,7 +266,23 @@ main = hspec $ do
|
||||
describe "automatic decompression" $ do
|
||||
it "more complex test" $ do
|
||||
runGEvalTest "charmatch-complex-compressed" `shouldReturnAlmost` 0.1923076923076923
|
||||
|
||||
describe "line by line mode" $ do
|
||||
let sampleChallenge =
|
||||
GEvalSpecification
|
||||
{ gesOutDirectory = "test/likelihood-simple/likelihood-simple-solution",
|
||||
gesExpectedDirectory = Just "test/likelihood-simple/likelihood-simple",
|
||||
gesTestName = "test-A",
|
||||
gesOutFile = "out.tsv",
|
||||
gesExpectedFile = "expected.tsv",
|
||||
gesInputFile = "in.tsv",
|
||||
gesMetric = Likelihood,
|
||||
gesPrecision = Nothing }
|
||||
it "simple test" $ do
|
||||
results <- runLineByLineGeneralized sampleChallenge Data.Conduit.List.consume
|
||||
Prelude.map (\(LineRecord inp _ _ _ _) -> inp) results `shouldBe` ["foo",
|
||||
"bar",
|
||||
"baz",
|
||||
"baq"]
|
||||
|
||||
neverMatch :: Char -> Int -> Bool
|
||||
neverMatch _ _ = False
|
||||
|
4
test/likelihood-simple/likelihood-simple/test-A/in.tsv
Normal file
4
test/likelihood-simple/likelihood-simple/test-A/in.tsv
Normal file
@ -0,0 +1,4 @@
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
baq
|
|
Loading…
Reference in New Issue
Block a user