Commit 2a9336b7 authored by Akim Demaille's avatar Akim Demaille
Browse files

tests: push-weights: improve

* tests/python/push-weights.py: Use CHECK_EQUIV instead of
checking the equality of the valuation for some words.
parent 68e378f5
......@@ -169,6 +169,7 @@ def CHECK_EQUIV(a1, a2):
# Cannot compute equivalence on Zmin, approximate with shortest.
if str(a1.context()).endswith('zmin') or str(a2.context()).endswith('zmin'):
num = 10
res = a1.shortest(num) == a2.shortest(num)
else:
res = a1.is_equivalent(a2)
......
......@@ -3,12 +3,12 @@
import vcsn
from test import *
def push_weights_check(i, o, words):
def check(i, o):
i1 = i.push_weights()
CHECK_EQ(o, i1)
for w in words:
CHECK_EQ(o.eval(w), i1.eval(w))
CHECK_EQUIV(o, i1)
# q
i = vcsn.automaton('''digraph {
vcsn_context = "lal_char(abc), q"
I0 -> 0
......@@ -29,9 +29,9 @@ o = vcsn.automaton('''digraph {
3 -> 4 [label = "b"]
4 -> F4
}''')
words = ["abcb", "ac", "abc", "bc"]
push_weights_check(i, o, words)
check(i, o)
# zmin.
i = vcsn.automaton('''digraph {
vcsn_context = "lal_char(a-f), zmin"
I0 -> 0
......@@ -50,9 +50,9 @@ o = vcsn.automaton('''digraph {
2 -> 3 [label = "<0>e, <1>f"]
3 -> F3
}''')
words = ["a", "af", "bde", "bc", "ca"]
push_weights_check(i, o, words)
check(i, o)
# q
i = vcsn.automaton('''digraph {
vcsn_context = "lal_char(abc), q"
I0 -> 0
......@@ -73,9 +73,9 @@ o = vcsn.automaton('''digraph {
2 -> 3 [label = "<14/19>c"]
3 -> F3
}''')
words = ["ab", "abc", "ac", "cb"]
push_weights_check(i, o, words)
check(i, o)
# zmin
i = vcsn.automaton('''digraph {
vcsn_context = "lal_char(abc), zmin"
I0 -> 0
......@@ -96,5 +96,4 @@ o = vcsn.automaton('''digraph {
2 -> 3 [label = "<4>c"]
3 -> F3 [label = "<0>"]
}''')
words = ["ab", "abc", "ac", "cb"]
push_weights_check(i, o, words)
check(i, o)
Supports Markdown
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