package au.id.zancanaro; import au.id.zancanaro.annotations.Property; import au.id.zancanaro.annotations.Seed; import org.hamcrest.CoreMatchers; import org.junit.*; import org.junit.experimental.theories.DataPoint; import org.junit.matchers.JUnitMatchers; import org.junit.runner.RunWith; import java.util.ArrayList; import java.util.Collections; import java.util.List; @RunWith(PropertyTestRunner.class) public class PropertyTests { public static Generator gen = Generators.integer(); public static Generator> list = Generators.listOf(Generators.integer()); @Ignore @Property public void aIsNotOdd(int a, int b) { Assert.assertFalse(a % 2 == 1); } @Ignore @Property public void aIsNotLessThanB(int a, int b) { Assert.assertFalse(a < b); } @Ignore @Property public void aPlusBLessThanOneHundred(int a, int b) { Assert.assertTrue(a + b < 100); } @Property public void sortingIsIdempotent(List list) { List left = new ArrayList<>(list); Collections.sort(left); List right = new ArrayList<>(list); Collections.sort(right); Collections.sort(right); Assert.assertEquals(left, right); } @Property public void reverseIsItsOwnInverse(List list) { List reversed = new ArrayList<>(list); Collections.reverse(reversed); Collections.reverse(reversed); Assert.assertEquals(list, reversed); } }