Example #1
0
def test_less_antisymmetric(x, y):
    less_xy = simplify(lib.less(x, y))
    less_yx = simplify(lib.less(y, x))
    equal_xy = simplify(lib.equal(x, y))
    print('LESS: {}, NLESS: {}, EQUAL: {}'.format(less_xy, less_yx, equal_xy))
    if less_xy is true and less_yx is true:
        assert equal_xy is true
    if equal_xy is false:
        assert less_xy is false or less_yx is false
Example #2
0
def test_less_antisymmetric(x, y):
    hypothesis.assume(x is not y)
    less_xy = simplify(lib.less(x, y))
    less_yx = simplify(lib.less(y, x))
    equal_xy = simplify(lib.equal(x, y))
    hypothesis.assume(less_xy in bool_values)
    hypothesis.assume(less_yx in bool_values)
    if less_xy is true and less_yx is true:
        assert equal_xy is true
    if equal_xy is false:
        assert less_xy is not true or less_yx is not true
Example #3
0
def test_less_transitive(x, y, z):
    # hypothesis.assume(x is not y and x is not z and y is not z)
    less_xy = simplify(lib.less(x, y))
    hypothesis.assume(less_xy in bool_values)
    less_yz = simplify(lib.less(y, z))
    hypothesis.assume(less_yz in bool_values)
    less_xz = simplify(lib.less(x, z))
    hypothesis.assume(less_xz in bool_values)
    if less_xy is true and less_yz is true:
        assert less_xz is true
    if less_xz is false:
        assert less_xy is not true or less_yz is not true
Example #4
0
def test_less_reflexive(x):
    less_xx = simplify(lib.less(x, x))
    assert less_xx == true
Example #5
0
def test_less(x, y, expected):
    assert simplify(lib.less(x, y)) == expected
Example #6
0
    # hypothesis.assume(x is not y and x is not z and y is not z)
    equal_xy = simplify(lib.equal(x, y))
    hypothesis.assume(equal_xy in bool_values)
    equal_yz = simplify(lib.equal(y, z))
    hypothesis.assume(equal_yz in bool_values)
    equal_xz = simplify(lib.equal(x, z))
    hypothesis.assume(equal_xz in bool_values)
    if equal_xy is true and equal_yz is true:
        assert equal_xz is true
    if equal_xz is false:
        assert equal_xy is false or equal_yz is false


@for_each(
    [
        (x, y, lib.less(x, y)),
        (quote(x), quote(x), true),
        (quote(undefined), quote(error), true),
        (quote(error), quote(undefined), false),
        (error, x, error),
        (x, error, error),
        (undefined, x, lib.less(undefined, x)),
        (x, undefined, lib.less(x, undefined)),
        (undefined, quote(x), lib.less(undefined, quote(x))),
        (quote(x), undefined, lib.less(quote(x), undefined)),
        (undefined, quote(error), true),
        (quote(undefined), undefined, true),
        (quote(error), quote(error), true),
        (quote(error), quote(undefined), false),
        (quote(error), quote(num(0)), false),
        (quote(error), quote(num(1)), false),