Commit 3d90bcc8 authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Add Nadal canned Phylo corpus for testing

parent 1bff83b6
Pipeline #5851 passed with stages
in 153 minutes and 54 seconds
......@@ -37,6 +37,9 @@ data-files:
test-data/ngrams/simple.csv
test-data/phylo/bpa_phylo_test.json
test-data/phylo/cleopatre.golden.json
test-data/phylo/nadal.golden.json
test-data/phylo/nadal_docslist.golden.json
test-data/phylo/nadal_ngramslist.golden.json
test-data/phylo/issue-290-small.golden.json
test-data/phylo/open_science.json
test-data/phylo/small-phylo.golden.json
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -58,6 +58,7 @@ tests = testGroup "Phylo" [
, testGroup "toPhyloWithoutLink" [
testCase "returns expected data" testSmallPhyloWithoutLinkExpectedOutput
, testCase "phyloCleopatre returns expected data" testCleopatreWithoutLinkExpectedOutput
, testCase "Nadal canned corpus returns expected data" testNadalWithoutLinkExpectedOutput
]
, testGroup "phylo2dot2json" [
testCase "is deterministic" testPhylo2dot2json
......@@ -76,6 +77,23 @@ testCleopatreWithoutLinkExpectedOutput = do
expected <- readPhylo =<< getDataFileName "test-data/phylo/cleopatre.golden.json"
assertBool (show $ ansiWlEditExprCompact $ ediff expected actual) (expected == actual)
testNadalWithoutLinkExpectedOutput :: Assertion
testNadalWithoutLinkExpectedOutput = do
corpusPath' <- getDataFileName "test-data/phylo/nadal_docslist.golden.csv"
listPath' <- getDataFileName "test-data/phylo/nadal_ngramslist.golden.csv"
let config = phyloTestConfig { corpusPath = corpusPath'
, listPath = listPath'
, listParser = V3
}
mapList <- fileToList (listParser config) (listPath config)
corpus <- fileToDocsDefault (corpusParser config)
(corpusPath config)
[Year 3 1 5,Month 3 1 5,Week 4 2 5]
mapList
let actual = setConfig phyloTestConfig $ toPhyloWithoutLink corpus config
expected <- setConfig phyloTestConfig <$> (readPhylo =<< getDataFileName "test-data/phylo/nadal.golden.json")
assertBool (show $ ansiWlEditExprCompact $ ediff expected actual) (expected == actual)
testSmallPhyloWithoutLinkExpectedOutput :: Assertion
testSmallPhyloWithoutLinkExpectedOutput = do
bpaConfig <- getDataFileName "bench-data/phylo/bpa-config.json"
......@@ -91,7 +109,7 @@ testSmallPhyloWithoutLinkExpectedOutput = do
mapList
let actual = setConfig phyloTestConfig $ toPhyloWithoutLink corpus config
expected <- setConfig phyloTestConfig <$> (readPhylo =<< getDataFileName "test-data/phylo/small-phylo.golden.json")
assertBool (show $ ansiWlEditExpr $ ediff expected actual) (expected == actual)
assertBool (show $ ansiWlEditExprCompact $ ediff expected actual) (expected == actual)
testPhylo2dot2json :: Assertion
testPhylo2dot2json = do
......@@ -103,7 +121,7 @@ testPhylo2dot2json = do
case actual_e of
Left err -> fail err
Right (actual :: GraphData) -> do
assertBool ("Phylo mismatch!" <> show (ansiWlEditExpr $ ediff expected actual)) (expected `compareGraphDataFuzzy` actual)
assertBool ("Phylo mismatch!" <> show (ansiWlEditExprCompact $ ediff expected actual)) (expected `compareGraphDataFuzzy` actual)
compareGraphDataFuzzy :: GraphData -> GraphData -> Bool
compareGraphDataFuzzy gd1 gd2 =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment