Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Informatik 8
CoPaR
Commits
92efd0a8
Commit
92efd0a8
authored
Jan 03, 2019
by
Hans-Peter Deifel
Browse files
Fix tests
parent
b090cb5a
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
tests/Copar/Algorithm/InitializeSpec.hs
View file @
92efd0a8
...
...
@@ -80,7 +80,7 @@ enc f1s transitions = Encoding.new (V.fromList f1s) edges
initialize'
::
[
Bool
]
->
[(
State
,
State
)]
->
ST
s
([
Block
],
AlgoState
s
Powerset
)
initialize'
f1s
transitions
=
initialize
@
Powerset
(
enc
f1s
(
map
mkEdge
transitions
))
initialize
@
Powerset
(
enc
f1s
(
map
mkEdge
transitions
))
True
where
mkEdge
(
from
,
to
)
=
(
from
,
()
,
to
)
...
...
tests/Copar/Algorithm/SplitSpec.hs
View file @
92efd0a8
...
...
@@ -281,7 +281,7 @@ withState
->
(
forall
s
.
SplitM
s
f
a
)
->
a
withState
e
action
=
runST
$
do
(
q
,
as
)
<-
initialize
e
(
q
,
as
)
<-
initialize
e
True
queue
<-
Queue
.
empty
20
mapM_
(
Queue
.
enqueue
queue
)
q
runSplit
as
queue
action
...
...
tests/Copar/Functors/AbsorbingPolynomialSpec.hs
View file @
92efd0a8
...
...
@@ -228,13 +228,13 @@ refineSpec = describe "refining" $ do
it
"distinguishes constants"
$
do
let
Right
enc
=
morphp
(
mkPoly
[[
c
[
"a"
,
"b"
]]])
"x: inj 0 (a)
\n
y: inj 0 (b)"
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
AbsorbingPolynomial
))
enc
)
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
AbsorbingPolynomial
))
enc
True
)
(
Part
.
toBlocks
part
)
`
shouldMatchList
`
[[
0
],
[
1
]]
it
"distinguishes co-factors"
$
do
let
f
=
mkPoly
[[
c
[
"a"
]],
[
c
[
"a"
]]]
let
Right
enc
=
morphp
f
"x: inj 0 (a)
\n
y: inj 1 (a)"
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
AbsorbingPolynomial
))
enc
)
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
AbsorbingPolynomial
))
enc
True
)
(
Part
.
toBlocks
part
)
`
shouldMatchList
`
[[
0
],
[
1
]]
it
"correctly identifies factors"
$
do
...
...
@@ -249,7 +249,7 @@ refineSpec = describe "refining" $ do
\
y: inj 1 (b, a)"
res
`
shouldSatisfy
`
isRight
let
Right
enc
=
res
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
AbsorbingPolynomial
))
enc
)
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
AbsorbingPolynomial
))
enc
True
)
(
Part
.
numBlocks
part
)
`
shouldBe
`
4
it
"correctly distinguishes different exponential values"
$
do
...
...
@@ -264,7 +264,7 @@ refineSpec = describe "refining" $ do
\
y: inj 1 {i: b, j: a}"
res
`
shouldSatisfy
`
isRight
let
Right
enc
=
res
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
AbsorbingPolynomial
))
enc
)
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
AbsorbingPolynomial
))
enc
True
)
(
Part
.
numBlocks
part
)
`
shouldBe
`
4
...
...
tests/Copar/Functors/BagSpec.hs
View file @
92efd0a8
...
...
@@ -53,7 +53,7 @@ refineSpec = describe "refining" $ do
it
"distinguishes points with different successor count"
$
let
Right
(
_
,
enc
)
=
parseMorphisms
f
EnableSanityChecks
""
"x: {x, x, y}
\n
y: {x, y}"
in
stToIO
(
refine
(
Proxy
@
(
Desorted
Bag
))
enc
)
in
stToIO
(
refine
(
Proxy
@
(
Desorted
Bag
))
enc
True
)
`
shouldReturn
`
(
Part
.
fromBlocks
[[
0
],
[
1
]])
-- FIXME: Remove duplicate definition of this function
...
...
tests/Copar/Functors/DistributionSpec.hs
View file @
92efd0a8
...
...
@@ -84,7 +84,7 @@ refineSpec = describe "refining" $ do
let
x
=
parseMorphisms
f
EnableSanityChecks
""
"x: {z: 1.0}
\n
y: {z: 1.0}
\n
z: {y: 1.0}"
x
`
shouldSatisfy
`
isRight
let
Right
(
_
,
enc
)
=
x
stToIO
(
refine
(
Proxy
@
(
Desorted
Distribution
))
enc
)
`
shouldReturn
`
Part
.
fromBlocks
[[
0
,
1
,
2
]]
stToIO
(
refine
(
Proxy
@
(
Desorted
Distribution
))
enc
True
)
`
shouldReturn
`
Part
.
fromBlocks
[[
0
,
1
,
2
]]
-- FIXME: Remove duplicate definition of this function
encoding
::
[
f1
]
->
[(
Int
,
l
,
Int
)]
->
Encoding
l
f1
...
...
tests/Copar/Functors/MonoidValuedSpec.hs
View file @
92efd0a8
...
...
@@ -94,12 +94,12 @@ maxIntRefineSpec = describe "maxInt refine" $ do
it
"it distinguishes different maximas with equal sums"
$
do
let
Right
enc
=
p
"x: {x: 1, y: 3}
\n
y: {x: 2, y: 2}"
part
<-
stToIO
(
refine
proxy
enc
)
part
<-
stToIO
(
refine
proxy
enc
True
)
(
Part
.
toBlocks
part
)
`
shouldMatchList
`
[[
0
],
[
1
]]
it
"identifies equal maximas with different sums"
$
do
let
Right
enc
=
p
"x: {x: 1, y: 3}
\n
y: {x: 3, y: 2}"
part
<-
stToIO
(
refine
proxy
enc
)
part
<-
stToIO
(
refine
proxy
enc
True
)
(
Part
.
toBlocks
part
)
`
shouldMatchList
`
[[
0
,
1
]]
...
...
@@ -154,12 +154,12 @@ maxRealRefineSpec = describe "maxReal refine" $ do
it
"it distinguishes different maximas with equal sums"
$
do
let
Right
enc
=
p
"x: {x: 1.1, y: 3.1}
\n
y: {x: 2.1, y: 2.1}"
part
<-
stToIO
(
refine
proxy
enc
)
part
<-
stToIO
(
refine
proxy
enc
True
)
(
Part
.
toBlocks
part
)
`
shouldMatchList
`
[[
0
],
[
1
]]
it
"identifies equal maximas with different sums"
$
do
let
Right
enc
=
p
"x: {x: 1.1, y: 3.1}
\n
y: {x: 3.1, y: 2.1}"
part
<-
stToIO
(
refine
proxy
enc
)
part
<-
stToIO
(
refine
proxy
enc
True
)
(
Part
.
toBlocks
part
)
`
shouldMatchList
`
[[
0
,
1
]]
...
...
tests/Copar/Functors/PolynomialSpec.hs
View file @
92efd0a8
...
...
@@ -341,13 +341,13 @@ refineSpec = describe "refining" $ do
it
"distinguishes constants"
$
do
let
Right
enc
=
morphp
(
mkPoly
[[
c
[
"a"
,
"b"
]]])
"x: inj 0 (a)
\n
y: inj 0 (b)"
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
Polynomial
))
enc
)
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
Polynomial
))
enc
True
)
(
Part
.
toBlocks
part
)
`
shouldMatchList
`
[[
0
],
[
1
]]
it
"distinguishes co-factors"
$
do
let
f
=
mkPoly
[[
c
[
"a"
]],
[
c
[
"a"
]]]
let
Right
enc
=
morphp
f
"x: inj 0 (a)
\n
y: inj 1 (a)"
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
Polynomial
))
enc
)
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
Polynomial
))
enc
True
)
(
Part
.
toBlocks
part
)
`
shouldMatchList
`
[[
0
],
[
1
]]
it
"correctly identifies factors"
$
do
...
...
@@ -360,7 +360,7 @@ refineSpec = describe "refining" $ do
\
y: inj 1 (b, a)"
res
`
shouldSatisfy
`
isRight
let
Right
enc
=
res
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
Polynomial
))
enc
)
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
Polynomial
))
enc
True
)
(
Part
.
numBlocks
part
)
`
shouldBe
`
4
it
"correctly distinguishes different exponential values"
$
do
...
...
@@ -373,7 +373,7 @@ refineSpec = describe "refining" $ do
\
y: inj 1 {i: b, j: a}"
res
`
shouldSatisfy
`
isRight
let
Right
enc
=
res
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
Polynomial
))
enc
)
part
<-
stToIO
(
refine
(
Proxy
@
(
Desorted
Polynomial
))
enc
True
)
(
Part
.
numBlocks
part
)
`
shouldBe
`
4
-- Helpers
...
...
tests/Examples.hs
View file @
92efd0a8
...
...
@@ -43,5 +43,5 @@ process file =
>>=
\
case
Left
err
->
return
err
Right
(
f
,
(
symTab
,
enc
))
->
do
partition
<-
stToIO
(
refine
f
enc
)
partition
<-
stToIO
(
refine
f
enc
True
)
return
$
T
.
unpack
(
showPartition
enc
symTab
partition
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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