diff --git a/library/cadbiom/models/clause_constraints/mcl/MCLSolutions.py b/library/cadbiom/models/clause_constraints/mcl/MCLSolutions.py index 006782be780f966030bd7736c200ca21d97fcb66..146b56204197ecf8359f1b1d8ff6d3d2f5167fb8 100644 --- a/library/cadbiom/models/clause_constraints/mcl/MCLSolutions.py +++ b/library/cadbiom/models/clause_constraints/mcl/MCLSolutions.py @@ -392,7 +392,8 @@ class FrontierSolution(object): @param other: a DimacsFrontierSol @return bool """ - return set(self.frontier_values) == set(other.frontier_values) + # return set(self.frontier_values) == set(other.frontier_values) + raise NotImplementedError def save(self, outfile): """ diff --git a/library/cadbiom/models/clause_constraints/mcl/TestCLUnfolder.py b/library/cadbiom/models/clause_constraints/mcl/TestCLUnfolder.py index 8e972877b6155ac43a22274d347fc6c008fd67bb..ec2069ae122e6a4f90cf4d2b15fca1e470b3832e 100644 --- a/library/cadbiom/models/clause_constraints/mcl/TestCLUnfolder.py +++ b/library/cadbiom/models/clause_constraints/mcl/TestCLUnfolder.py @@ -148,6 +148,12 @@ def model4(): node_i = root.add_input_node('in1', 0, 0) tri = root.add_transition(node_i, node_1) tri.set_condition("n5") + + # Frontier test: Add a start node on n3 or do not attempt any frontier + # place because there is a SCC composed of n3, n4, n5. + #node_s = root.add_start_node('s1', 0, 0) + #root.add_transition(node_s, node_3) + return model def create_unfolder(model): @@ -247,8 +253,8 @@ class TestCLUnfolder(unittest.TestCase): model = model4() unfolder = create_unfolder(model) cfr = unfolder.get_frontier() - res = len(cfr) == 1 - res = res and unfolder.get_var_name(cfr[0]) == 'n3' + res = len(cfr) == 0 +# res = res and unfolder.get_var_name(cfr[0]) == 'n3' self.assert_(res,'Error in frontier: model4') diff --git a/library/cadbiom/models/clause_constraints/mcl/TestMCLAnalyser.py b/library/cadbiom/models/clause_constraints/mcl/TestMCLAnalyser.py index 38378eb8ca085cb7b658ebb2ea05ae4aef880568..3b8a0afacb0c1372c9a01efec249c2e087b3d81b 100644 --- a/library/cadbiom/models/clause_constraints/mcl/TestMCLAnalyser.py +++ b/library/cadbiom/models/clause_constraints/mcl/TestMCLAnalyser.py @@ -41,7 +41,7 @@ """ Unitary Tests for the MCLAnalyser """ - +from __future__ import print_function import unittest import sys, os @@ -50,6 +50,7 @@ from cadbiom.models.guard_transitions.simulator.chart_simul import ChartSimulato from cadbiom.models.guard_transitions.chart_model import ChartModel from cadbiom.models.clause_constraints.mcl.MCLQuery import MCLSimpleQuery from cadbiom.models.clause_constraints.mcl.MCLSolutions import FrontierSolution +from cadbiom.commons import DIR_LOGS TRACE_FILE = sys.stdout #TRACE_FILE = open("/tmp/testMCLAnalyzer.txt",'w') @@ -99,13 +100,13 @@ class ErrorRep(object): just printing """ self.error = True - print '\n>> '+self.context+" "+mess + print('\n>> '+self.context+" "+mess) def display_info(self, mess): """ just printing """ - print '\n-- '+mess + print('\n-- '+mess) def set_context(self, cont): """ @@ -146,6 +147,7 @@ class TestMCLAnaLyzer(unittest.TestCase): res = lit_sol_equal(sol1, sol2) self.assert_(not res, 'Error in lit_sol inequality: number case') + @unittest.skip("Test files not provided") def test_load1(self): """ Load from a bcx file @@ -167,6 +169,7 @@ class TestMCLAnaLyzer(unittest.TestCase): res = rep.error self.assert_(not res, 'Error in load2') + @unittest.skip("Test files not provided") def test_load3(self): """ Load from a PID file @@ -332,6 +335,7 @@ class TestMCLAnaLyzer(unittest.TestCase): self.assert_(res, 'Error unflatten') + @unittest.skip("Test files not provided") def test_dimacs_frontier(self): """ frontier solution in DIMACS form @@ -363,6 +367,7 @@ class TestMCLAnaLyzer(unittest.TestCase): res = res and (sol.get_solution()[i] == sol2.get_solution()[i]) self.assert_(not res, 'Error dimacs_frontier: solutions not different') + @unittest.skip("Test files not provided") def test_prune(self): """ pruning a solution @@ -554,23 +559,26 @@ class TestMCLAnaLyzer(unittest.TestCase): query = MCLSimpleQuery(None, None, f_prop) macwic = mcla.mac_search(query, 10) - f_out = file("x_file", 'w') + f_out = file(DIR_LOGS + "x_file", 'w') # print macwic[0].activated_frontier # print macwic[0].ic_sequence # print '---------------' macwic[0].save(f_out) - r_front = FrontierSolution.from_file("x_file") + r_front = FrontierSolution.from_file(DIR_LOGS + "x_file") # print r_front.activated_frontier # print r_front.ic_sequence - res = r_front.has_same_frontier(macwic[0]) + res = set(macwic[0].activated_frontier) == set(r_front.activated_frontier) + res = res and set( macwic[0].ic_sequence) == set(r_front.ic_sequence) + # res = r_front.has_same_frontier(macwic[0]) # Not implemented self.assert_(res, "Frontier solutions differ after read") - os.remove("x_file") + os.remove(DIR_LOGS + "x_file") def test_mac_inhibitor(self): """ test + [A1, B1,C1] not strong activator, D is a strong inhibitor """ rep = ErrorRep() mcla = MCLAnalyser(rep) diff --git a/library/cadbiom/models/clause_constraints/mcl/TestMCLTranslators.py b/library/cadbiom/models/clause_constraints/mcl/TestMCLTranslators.py index b8dd947532fb7cdb7ab71a16bf134a8c2aaa81ab..29deb0e8c1161612bf5ab96a9152aca0b8f5bf77 100644 --- a/library/cadbiom/models/clause_constraints/mcl/TestMCLTranslators.py +++ b/library/cadbiom/models/clause_constraints/mcl/TestMCLTranslators.py @@ -769,6 +769,7 @@ class TestFull(unittest.TestCase): TRACE_FILE.write( 'place_clocks'+ cl_ds.place_clocks.__str__()+'\n') TRACE_FILE.write( 'inputs'+ cl_ds.inputs.__str__()+'\n') + @unittest.skip("Test files not provided") def test_tgf_no_clock(self): """ optimisation gain comparison