generator.generateRandomPosNeg(posOrNegPerChunk*2,chunkNumber,false);
Collection<List<String>> previousChunk = null;
for(int i=0;i<chunkNumber;++i)
{
final PTASequenceEngine currentPTA = generator.getAllSequences(i);
Collection<List<String>> currentSequences = currentPTA.getData(PTASequenceEngine.truePred);
Assert.assertTrue(2*posOrNegPerChunk*(i+1)> currentSequences.size());
int positive = 0,negative=0;
PTASequenceEngine positivePTA = currentPTA.filter(currentPTA.getFSM_filterPredicate());
PTASequenceEngine negativePTA = currentPTA.filter(new FilterPredicate() {
FilterPredicate origFilter = currentPTA.getFSM_filterPredicate();
@Override
public boolean shouldBeReturned(Object name) {
return !origFilter.shouldBeReturned(name);
}
});
for(List<String> s:currentSequences)
if(graph.paths.tracePathPrefixClosed(s) >=0)
{
++negative;
Assert.assertFalse(positivePTA.containsSequence(s));Assert.assertTrue(negativePTA.containsSequence(s));
}
else
{
++positive;
Assert.assertTrue(positivePTA.containsSequence(s));Assert.assertFalse(negativePTA.containsSequence(s));
}
Assert.assertTrue(posOrNegPerChunk*(i+1) > positive);Assert.assertEquals(positive,positivePTA.getData(PTASequenceEngine.truePred).size());
Assert.assertEquals(positive,positivePTA.getData().size());// all seq are accept ones
Assert.assertTrue(posOrNegPerChunk*(i+1) > negative);Assert.assertEquals(negative,negativePTA.getData(PTASequenceEngine.truePred).size());
Assert.assertEquals(0,negativePTA.getData().size());// all seq are reject ones
if (previousChunk != null) currentSequences.containsAll(previousChunk);
previousChunk= currentSequences;
}
}