int source;
int target;
int start = rand.nextInt(100000) + 100;
int count = rand.nextInt(100000) + 100;
Range range = new Range(start, count);
Connection conn;
ConnectionFilter connFilter = new TransitivePartitionConnectionFilter(range);
source = range.getStart();
target = range.getStart();
conn = new SimpleConnection(source, target, true);
assertEquals(true, connFilter.accept(conn));
source = range.getStart();
target = range.getStart() - rand.nextInt(range.getStart());
conn = new SimpleConnection(source, target, true);
assertEquals(true, connFilter.accept(conn));
source = range.getStart();
target = range.getEnd();
conn = new SimpleConnection(source, target, true);
assertEquals(true, connFilter.accept(conn));
source = range.getStart();
target = range.getEnd() + rand.nextInt(range.getEnd());
conn = new SimpleConnection(source, target, true);
assertEquals(true, connFilter.accept(conn));
for(int i = 0, cnt = rand.nextInt(100); i < cnt; i++) {
source = range.getStart() + rand.nextInt(range.getCount());
target = Math.abs(rand.nextInt());
conn = new SimpleConnection(source, target, true);
assertEquals(true, connFilter.accept(conn));
source = Math.abs(rand.nextInt());
target = range.getStart() + rand.nextInt(range.getCount());
conn = new SimpleConnection(source, target, true);
assertEquals(true, connFilter.accept(conn));
}
for(int i = 0, cnt = rand.nextInt(100); i < cnt; i++) {
source = range.getStart() - rand.nextInt(range.getStart()) - 1;
target = range.getStart() - rand.nextInt(range.getStart()) - 1;
conn = new SimpleConnection(source, target, true);
assertEquals(false, connFilter.accept(conn));
source = range.getStart() - rand.nextInt(range.getStart()) - 1;
target = range.getEnd() + rand.nextInt(range.getEnd());
conn = new SimpleConnection(source, target, true);
assertEquals(false, connFilter.accept(conn));
source = range.getEnd() + rand.nextInt(range.getEnd());
target = range.getStart() - rand.nextInt(range.getStart()) - 1;
conn = new SimpleConnection(source, target, true);
assertEquals(false, connFilter.accept(conn));
source = range.getEnd() + rand.nextInt(range.getEnd());
target = range.getEnd() + rand.nextInt(range.getEnd());
conn = new SimpleConnection(source, target, true);
assertEquals(false, connFilter.accept(conn));
}
}