private void checkGt(final PossibilityArithmetic arith, final double a, final double b) { final double ap = arith.prob2Poss(a); final double bp = arith.prob2Poss(b); if (a > b + tolerance()) { assertTrue(arith.gt(ap, bp)); assertFalse(arith.gt(bp, ap)); } else if (b > a + tolerance()) { assertFalse(arith.gt(ap, bp)); assertTrue(arith.gt(bp, ap)); } }
public void testGt() { final PossibilityArithmetic arith = arithmetic(); assertTrue(arith.gt(arith.one(), arith.zero())); assertFalse(arith.gt(arith.zero(), arith.one())); checkGt(arith, 0.4, 0.5); checkGt(arith, 0.50, 0.5142); checkGt(arith, 0.51, 0.5142); checkGt(arith, 0.514, 0.5142); checkGt(arith, 0.5142, 0.5142); checkGt(arith, 0.1, 0.0); checkGt(arith, 0.01, 0.0); checkGt(arith, 0.001, 0.0); checkGt(arith, 0.0001, 0.0); checkGt(arith, 0.00001, 0.0); checkGt(arith, 0.000001, 0.0); checkGt(arith, 1.0, 0.9); checkGt(arith, 1.0, 0.99); checkGt(arith, 1.0, 0.999); checkGt(arith, 1.0, 0.9999); checkGt(arith, 1.0, 0.99999); }