Assert.assertEquals(chunkNumber, generator.getChunkNumber());
for(int i=0;i<chunkNumber;++i)
{
final PTASequenceEngine currentPTA = generator.getAllSequences(i);
Collection<List<Label>> currentSequences = currentPTA.getData(PTASequenceEngine.truePred);
Assert.assertEquals("chunk "+i+" (neg) should be of length "+(2*posOrNegPerChunk*(i+1))+" but it was "+currentSequences.size(),(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<Label> 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.assertEquals(posOrNegPerChunk*(i+1), positive);Assert.assertEquals(positive,positivePTA.getData(PTASequenceEngine.truePred).size());
Assert.assertEquals(positive,positivePTA.getData().size());// all seq are accept ones
Assert.assertEquals(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;
}
checkForCorrectException(new whatToRun() { @Override public void run() {