summaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@zancanaro.id.au>2015-05-30 02:00:43 +1000
committerCarlo Zancanaro <carlo@zancanaro.id.au>2015-05-30 02:00:43 +1000
commitd29e1d49116c66adab72b1c1bb49c1fa3d4f8140 (patch)
tree17363b0d5b939c217cc95e4c57326e01c45d121e /src/test/java
Initial commit: only works for plain int typed arguments
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/au/id/zancanaro/PropertyTests.java15
-rw-r--r--src/test/java/au/id/zancanaro/SimpleGenerator.java19
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/java/au/id/zancanaro/PropertyTests.java b/src/test/java/au/id/zancanaro/PropertyTests.java
new file mode 100644
index 0000000..0c9bb7e
--- /dev/null
+++ b/src/test/java/au/id/zancanaro/PropertyTests.java
@@ -0,0 +1,15 @@
+package au.id.zancanaro;
+
+import au.id.zancanaro.annotations.Property;
+import au.id.zancanaro.annotations.Seed;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.runner.RunWith;
+
+@RunWith(PropertyTestRunner.class)
+public class PropertyTests {
+ @Property
+ public void method(int a, int b) {
+ Assert.assertFalse(a < b);
+ }
+}
diff --git a/src/test/java/au/id/zancanaro/SimpleGenerator.java b/src/test/java/au/id/zancanaro/SimpleGenerator.java
new file mode 100644
index 0000000..1b1d570
--- /dev/null
+++ b/src/test/java/au/id/zancanaro/SimpleGenerator.java
@@ -0,0 +1,19 @@
+package au.id.zancanaro;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Random;
+
+public class SimpleGenerator {
+ @Test
+ public void testSimpleGeneratorFlatmap() throws Exception {
+ Generator<Integer> generator = Generator
+ .pure(10)
+ .flatMap((value) ->
+ Generator.pure(value + 10));
+ Assert.assertEquals(
+ (Object) 20,
+ generator.generate(null, 0).getValue());
+ }
+}