Commit 1ec9eb87 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] Tests: partial refactor CLUnfolder

parent 0f193aa3
......@@ -484,8 +484,13 @@ def test_init_forward(feed_mclanalyser, textual_properties, numeric_properties):
- test variant properties
"""
mcla = feed_mclanalyser
pass
def test_init_forward_unfolding_solution_1(feed_mclanalyser, textual_properties, numeric_properties):
mcla = feed_mclanalyser
## First properties ########################################################
### Textual properties
start, invariant, final = textual_properties[0]
......@@ -502,7 +507,10 @@ def test_init_forward(feed_mclanalyser, textual_properties, numeric_properties):
init_forward_unfolding_solution_1(mcla)
## Second properties #######################################################
def test_init_forward_unfolding_solution_2(feed_mclanalyser, textual_properties, numeric_properties):
mcla = feed_mclanalyser
### Textual properties
start, invariant, final = textual_properties[1]
......@@ -525,6 +533,18 @@ def test_init_forward(feed_mclanalyser, textual_properties, numeric_properties):
# init_forward_unfolding_solution_2(mcla)
def test_init_forward_unfolding_solution_3(feed_mclanalyser, textual_properties, numeric_properties):
mcla = feed_mclanalyser
# Note: The second set creates auxiliary clauses that we could not insert
# in DIMACS form in the query so we use the text form for it.
query = MCLSimpleQuery(*textual_properties[1])
query.dim_start, query.dim_inv, query.dim_final = numeric_properties[0]
mcla.unfolder.init_with_query(query)
init_forward_unfolding_solution_3(mcla)
def init_forward_unfolding_solution_1(mcla):
"""
......@@ -716,6 +736,40 @@ def init_forward_unfolding_solution_2(mcla):
assert unfolder.final_constraints == [[50, -94], [58, -94], [-50, -58, 94], [94]]
def init_forward_unfolding_solution_3(mcla):
"""
- Test first part of init_forward_unfolding: init of constraints
- Test second part of init_forward_unfolding: shift of initialized constraints
Query:
start, invariant, final: Union of textual and DIMACS properties:
("", "L", "C and K") => [], [[12]], [[3, -47], [11, -47], [-3, -11, 47], [47]]
[[13]], [[12]], [[3]] <= ("M", "L", "C")
No solution
"""
unfolder = mcla.unfolder
## Init constraints ########################################################
init_forward_unfolding_part_1(mcla.unfolder)
print(1, unfolder.dynamic_constraints)
print(2, unfolder.initial_constraints)
print(3, unfolder.invariant_constraints)
print(5, unfolder.final_constraints)
assert unfolder.shift_step == 47
# no frontiers + "M" (start place)
# TODO: voir sol1 y'a un pb ici...
assert unfolder.initial_constraints == [[-1], [-2], [-3], [-8], [-10], [-11], [-13], [-15], [13]]
# Just append DIMACS constraints of the query: "L" + [[12]]
assert unfolder.invariant_constraints == [[[12]], [[12]]]
# Idem: "C and K" + "C" = [3, -47], [11, -47], [-3, -11, 47], [47] + [3]
assert unfolder.final_constraints == [[3, -47], [11, -47], [-3, -11, 47], [47], [3]]
def test_shift(feed_mclanalyser, textual_properties):
"""Test shift of constraints during the solutions search"""
......
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