MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit e92f1e4a authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib][test] Add some new asserts; fix typos

parent c5a67f5b
...@@ -143,7 +143,7 @@ def model4(): ...@@ -143,7 +143,7 @@ def model4():
root.add_transition(node_3, node_4) root.add_transition(node_3, node_4)
node_5 = root.add_simple_node('n5', 0, 0) node_5 = root.add_simple_node('n5', 0, 0)
tr1 = root.add_transition(node_4, node_5) tr1 = root.add_transition(node_4, node_5)
tr2 = root.add_transition(node_5, node_3) root.add_transition(node_5, node_3)
tr1.set_event("hh2") tr1.set_event("hh2")
tr1.set_condition("n1 and n3") tr1.set_condition("n1 and n3")
node_i = root.add_input_node('in1', 0, 0) node_i = root.add_input_node('in1', 0, 0)
...@@ -196,6 +196,12 @@ class TestCLUnfolder(unittest.TestCase): ...@@ -196,6 +196,12 @@ class TestCLUnfolder(unittest.TestCase):
""" """
model = model1() model = model1()
unfolder = create_unfolder(model) unfolder = create_unfolder(model)
# Test unfolder init and internal dynamic system
assert unfolder._CLUnfolder__shift_step == 2
assert unfolder.shift_step_init == 2
assert unfolder.get_var_number() == 2
# naming and coding variables # naming and coding variables
cn1 = unfolder.var_dimacs_code('n1') cn1 = unfolder.var_dimacs_code('n1')
cn2 = unfolder.var_dimacs_code('n2') cn2 = unfolder.var_dimacs_code('n2')
...@@ -214,6 +220,8 @@ class TestCLUnfolder(unittest.TestCase): ...@@ -214,6 +220,8 @@ class TestCLUnfolder(unittest.TestCase):
res = unfolder.get_var_indexed_name(8) == 'n2_3' res = unfolder.get_var_indexed_name(8) == 'n2_3'
self.assert_(res,'Error in variable name 5') self.assert_(res,'Error in variable name 5')
# Test number of variables
assert unfolder.get_system_var_number() == unfolder.get_var_number()
def test_frontier(self): def test_frontier(self):
...@@ -224,8 +232,8 @@ class TestCLUnfolder(unittest.TestCase): ...@@ -224,8 +232,8 @@ class TestCLUnfolder(unittest.TestCase):
model = model1() model = model1()
unfolder = create_unfolder(model) unfolder = create_unfolder(model)
# test frontier: should be n1 # test frontier: should be n1
cfr = unfolder.frontier_values[0] frontier_value = unfolder.frontier_values[0]
res = unfolder.get_var_name(cfr) == 'n1' res = unfolder.get_var_name(frontier_value) == 'n1'
res = res and (len(unfolder.frontier_values) == 1) res = res and (len(unfolder.frontier_values) == 1)
self.assert_(res,'Error in frontier: model1') self.assert_(res,'Error in frontier: model1')
...@@ -234,8 +242,8 @@ class TestCLUnfolder(unittest.TestCase): ...@@ -234,8 +242,8 @@ class TestCLUnfolder(unittest.TestCase):
unfolder = create_unfolder(model) unfolder = create_unfolder(model)
# test frontier: should be n1 # test frontier: should be n1
cfr = unfolder.frontier_values[0] frontier_value = unfolder.frontier_values[0]
res = unfolder.get_var_name(cfr) == 'n1' res = unfolder.get_var_name(frontier_value) == 'n1'
res = res and (len(unfolder.frontier_values) == 1) res = res and (len(unfolder.frontier_values) == 1)
self.assert_(res,'Error in frontier: model2') self.assert_(res,'Error in frontier: model2')
...@@ -244,18 +252,17 @@ class TestCLUnfolder(unittest.TestCase): ...@@ -244,18 +252,17 @@ class TestCLUnfolder(unittest.TestCase):
unfolder = create_unfolder(model) unfolder = create_unfolder(model)
# test frontier - should be {n1, n3} # test frontier - should be {n1, n3}
cfr = unfolder.frontier_values frontier_values = unfolder.frontier_values
res = len(cfr) == 2 res = len(frontier_values) == 2
res = res and unfolder.get_var_name(cfr[0]) == 'n1' res = res and unfolder.get_var_name(frontier_values[0]) == 'n1'
res = res and unfolder.get_var_name(cfr[1]) == 'n3' res = res and unfolder.get_var_name(frontier_values[1]) == 'n3'
self.assert_(res,'Error in frontier: model3') self.assert_(res,'Error in frontier: model3')
# model4 # model4
model = model4() model = model4()
unfolder = create_unfolder(model) unfolder = create_unfolder(model)
cfr = unfolder.frontier_values frontier_values = unfolder.frontier_values
res = len(cfr) == 0 res = len(frontier_values) == 0
# res = res and unfolder.get_var_name(cfr[0]) == 'n3'
self.assert_(res,'Error in frontier: model4') self.assert_(res,'Error in frontier: model4')
......
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