IllegalArgumentException exORIG = null;
{// testing the orig part
LearnerGraph s = buildLearnerGraph(machine, testName, testConfig);
PTASequenceEngine engine = new PTASequenceEngine();engine.init(new PTASequenceSetAutomaton());
PTASequenceEngine.SequenceSet initSet = engine.new SequenceSet();initSet.setIdentity();
PTASequenceEngine.SequenceSet paths = engine.new SequenceSet();
if (initSeq != null) initSet=initSet.cross(TestFSMAlgo.buildSet(initSeq, testConfig));
try
{
s.paths.ORIGcomputePathsSBetween(s.findVertex(FirstState), s.findVertex(SecondState),initSet,paths);
Map<String,String> actual = engine.getDebugDataMapDepth(paths);
Assert.assertTrue("expected: "+expected+", actual: "+actual, expected.equals(actual));
}
catch(IllegalArgumentException ex)
{ exORIG = ex; }
}
IllegalArgumentException exNew = null;
{// testing the new part
LearnerGraph s = buildLearnerGraph(machine, testName, testConfig);
PTASequenceEngine engine = new PTASequenceEngine();engine.init(new PTASequenceSetAutomaton());
PTASequenceEngine.SequenceSet initSet = engine.new SequenceSet();initSet.setIdentity();
PTASequenceEngine.SequenceSet paths = engine.new SequenceSet();
if (initSeq != null) initSet=initSet.cross(TestFSMAlgo.buildSet(initSeq, testConfig));
try
{
s.pathroutines.computePathsSBetween(s.findVertex(FirstState), s.findVertex(SecondState),initSet,paths);
Map<String,String> actual = engine.getDebugDataMapDepth(paths);
Assert.assertTrue("expected: "+expected+", actual: "+actual, expected.equals(actual));
}
catch(IllegalArgumentException ex)
{ exNew = ex; }
}
IllegalArgumentException exCaching = null;
{// testing the latest part with caching.
LearnerGraph s = buildLearnerGraph(machine, testName, testConfig);
PTASequenceEngine engine = new PTASequenceEngine();engine.init(new PTASequenceSetAutomaton());
PTASequenceEngine.SequenceSet initSet = engine.new SequenceSet();initSet.setIdentity();
if (initSeq != null) initSet=initSet.cross(TestFSMAlgo.buildSet(initSeq, testConfig));
try
{
Map<CmpVertex,PTASequenceEngine.SequenceSet> map = s.pathroutines.computePathsSBetween_All(s.findVertex(FirstState), engine,initSet);
PTASequenceEngine.SequenceSet pathsToSecondState = map.get(s.findVertex(SecondState));
if (pathsToSecondState == null)
throw new IllegalArgumentException("path from state "+FirstState+" to state "+SecondState+" was not found");
Map<String,String> actual = engine.getDebugDataMapDepth(pathsToSecondState);
// The one below only compares keysets because computePathsSBetween_All builds an entire tree and
// consequently most vertices will not be leaf ones.
Assert.assertTrue("expected: "+expected+", actual: "+actual, expected.keySet().equals(actual.keySet()));
}