Package fj.test

Examples of fj.test.Property.check()


    final Property p = property(arbInteger, new F<Integer, Property>() {
      public Property f(final Integer a) {
        return prop(isPositive(a) == (a != 0 && !isNegative(a)));
      }
    });
    summary.println(p.check()); // Falsified after 0 passed tests with argument: 0
  }
}
View Full Code Here


      public Property f(final MyClass m1, final MyClass m2) {
        return bool(m1.equals(m2)).implies(m1.hashCode() == m2.hashCode());
      }
    });
    // at least 100 from 10,000 should satisfy the premise (m1.equals(m2)) 
    summary.println(p.check(100, 10000, 0, 100)); // OK, passed 100 tests (4776 discarded).
  }
}
View Full Code Here

        new F2<Integer, Integer, Property>() {
      public Property f(final Integer a, final Integer b) {
        return bool(a > 0 && b > 0).implies(a + b > 0);
      }
    });
    summary.println(p.check()); // Falsified after 4 passed tests with arguments: [8,2147483647]
  }
}
View Full Code Here

        final LinkedList<Integer> xy = new LinkedList<Integer>(x);
        xy.addAll(y);
        return prop(xy.size() == x.size() + y.size());
      }
    });
    summary.println(p.check()); // OK, passed 100 tests.
  }
}
View Full Code Here

    final Property p = property(arbInteger, arbInteger, new F2<Integer, Integer, Property>() {
      public Property f(final Integer a, final Integer b) {
        return prop(a + b == b + a);
      }
    });
    summary.println(p.check()); // OK, passed 100 tests.
  }
}
View Full Code Here

            return prop(a + b == b + a);
          }
        });
      }
    });
    summary.println(p.check(1000000, 5000000, 0, 100)); // OK, passed 1000000 tests.
    pool.shutdown();
  }
}
View Full Code Here

    public void test1() {
        final Property p = property(arbInteger, a -> {
            P1<Integer> t = P.p(a).memo();
            return prop(t._1() == t._1());
        });
        summary.println(p.check());
    }

    @Test
    public void test2() {
        final Property p = property(arbInteger, arbInteger, (a, b) -> {
View Full Code Here

    public void test2() {
        final Property p = property(arbInteger, arbInteger, (a, b) -> {
            P2<Integer, Integer> t = P.p(a, b).memo();
            return prop(t._1() == t._1() && t._2() == t._2());
        });
        summary.println(p.check());
    }

    static P2<Integer, Integer> pair = P.p(0, 0);

    static Integer count(int i) {
View Full Code Here

    public void test3() {
        final Property p = property(arbInteger, arbInteger, arbInteger, (a, b, c) -> {
            P3<Integer, Integer, Integer> t = P.p(a, b, c).memo();
            return prop(t._1() == t._1() && t._2() == t._2() && t._3() == t._3());
        });
        summary.println(p.check());
    }

    @Test
    public void test4() {
        final Property p = property(arbInteger, arbInteger, arbInteger, arbInteger, (a, b, c, d) -> {
View Full Code Here

    public void test4() {
        final Property p = property(arbInteger, arbInteger, arbInteger, arbInteger, (a, b, c, d) -> {
            P4<Integer, Integer, Integer, Integer> t = P.p(a, b, c, d).memo();
            return prop(t._1() == t._1() && t._2() == t._2() && t._3() == t._3() && t._4() == t._4());
        });
        summary.println(p.check());
    }

    @Test
    public void test5() {
        final Property p = property(arbInteger, arbInteger, arbInteger, arbInteger, arbInteger, (a, b, c, d, e) -> {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.