@Test
public void limit() {

	final Engine<DoubleGene, Double> engine = Engine
		.builder(
			gt -> gt.gene().allele(),
			DoubleChromosome.of(0, 1))
		.build();
	final AtomicLong count = new AtomicLong();
	final EvolutionResult<DoubleGene, Double> result = engine.stream()
		.limit(new CountLimit(1000))
		.limit(new CountLimit(100))
		.limit(new CountLimit(10))
		.limit(new CountLimit(100))
		.peek(r -> count.incrementAndGet())
		.collect(EvolutionResult.toBestEvolutionResult());
	Assert.assertEquals(count.get(), 10L);
	Assert.assertEquals(result.totalGenerations(), 10L);
}