Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
191
Issues
191
List
Board
Labels
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
53f1acdc
Commit
53f1acdc
authored
Jun 30, 2025
by
Alfredo Di Napoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Amend Phylo golden test machinery
parent
282f63c0
Pipeline
#7710
passed with stages
in 51 minutes and 41 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
Phylo.hs
test/Test/Offline/Phylo.hs
+15
-11
No files found.
test/Test/Offline/Phylo.hs
View file @
53f1acdc
...
@@ -66,9 +66,15 @@ phyloGolden (fp, actualOutput) =
...
@@ -66,9 +66,15 @@ phyloGolden (fp, actualOutput) =
,
failFirstTime
=
True
,
failFirstTime
=
True
}
}
newtype
GraphDataFuzzy
=
GraphDataFuzzy
{
_GraphDataFuzzy
::
GraphData
}
instance
Eq
GraphDataFuzzy
where
(
GraphDataFuzzy
a
)
==
(
GraphDataFuzzy
b
)
=
a
`
compareGraphDataFuzzy
`
b
-- | Use this variant for those tests which requires a more sophisticated way of
-- | Use this variant for those tests which requires a more sophisticated way of
-- comparing outputs directly on the GraphData
-- comparing outputs directly on the GraphData
phyloGoldenGraphData
::
(
FilePath
,
GraphData
)
->
Golden
GraphData
phyloGoldenGraphData
::
(
FilePath
,
GraphData
Fuzzy
)
->
Golden
GraphDataFuzzy
phyloGoldenGraphData
(
goldenPath
,
new
)
=
phyloGoldenGraphData
(
goldenPath
,
new
)
=
Golden
{
Golden
{
output
=
new
output
=
new
...
@@ -80,16 +86,14 @@ phyloGoldenGraphData (goldenPath, new) =
...
@@ -80,16 +86,14 @@ phyloGoldenGraphData (goldenPath, new) =
,
failFirstTime
=
True
,
failFirstTime
=
True
}
}
where
where
differ
::
GraphData
->
String
differ
::
GraphDataFuzzy
->
String
differ
ref
=
case
compareGraphDataFuzzy
ref
new
of
differ
(
GraphDataFuzzy
ref
)
=
show
(
ansiWlEditExprCompact
$
ediff
ref
(
_GraphDataFuzzy
new
))
True
->
mempty
False
->
show
(
ansiWlEditExprCompact
$
ediff
ref
new
)
updateGolden
::
GraphData
->
IO
()
updateGolden
::
GraphData
Fuzzy
->
IO
()
updateGolden
gd
=
BL
.
writeFile
goldenPath
(
JSON
.
encodePretty
gd
)
updateGolden
(
GraphDataFuzzy
gd
)
=
BL
.
writeFile
goldenPath
(
JSON
.
encodePretty
gd
)
getGolden
::
IO
GraphData
getGolden
::
IO
GraphData
Fuzzy
getGolden
=
do
getGolden
=
GraphDataFuzzy
<$>
do
expected_e
<-
JSON
.
eitherDecodeFileStrict'
=<<
getDataFileName
goldenPath
expected_e
<-
JSON
.
eitherDecodeFileStrict'
=<<
getDataFileName
goldenPath
case
expected_e
of
case
expected_e
of
Left
err
->
fail
err
Left
err
->
fail
err
...
@@ -155,12 +159,12 @@ testSmallPhyloWithoutLinkExpectedOutput = do
...
@@ -155,12 +159,12 @@ testSmallPhyloWithoutLinkExpectedOutput = do
expected
<-
setConfig
phyloTestConfig
<$>
(
readPhylo
=<<
getDataFileName
"test-data/phylo/small-phylo.golden.json"
)
expected
<-
setConfig
phyloTestConfig
<$>
(
readPhylo
=<<
getDataFileName
"test-data/phylo/small-phylo.golden.json"
)
assertBool
(
show
$
ansiWlEditExprCompact
$
ediff
expected
actual
)
(
expected
==
actual
)
assertBool
(
show
$
ansiWlEditExprCompact
$
ediff
expected
actual
)
(
expected
==
actual
)
testPhylo2dot2json
::
IO
(
FilePath
,
GraphData
)
testPhylo2dot2json
::
IO
(
FilePath
,
GraphData
Fuzzy
)
testPhylo2dot2json
=
do
testPhylo2dot2json
=
do
actual_e
<-
JSON
.
parseEither
JSON
.
parseJSON
<$>
phylo2dot2json
Cleopatre
.
phyloCleopatre
actual_e
<-
JSON
.
parseEither
JSON
.
parseJSON
<$>
phylo2dot2json
Cleopatre
.
phyloCleopatre
case
actual_e
of
case
actual_e
of
Left
err
->
fail
err
Left
err
->
fail
err
Right
(
actual
::
GraphData
)
->
pure
(
"test-data/phylo/phylo2dot2json.golden.json"
,
actual
)
Right
(
actual
::
GraphData
)
->
pure
(
"test-data/phylo/phylo2dot2json.golden.json"
,
GraphDataFuzzy
actual
)
compareGraphDataFuzzy
::
GraphData
->
GraphData
->
Bool
compareGraphDataFuzzy
::
GraphData
->
GraphData
->
Bool
compareGraphDataFuzzy
gd1
gd2
=
compareGraphDataFuzzy
gd1
gd2
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment