コード例 #1
0
def test_gcd_consistency(a ,b):
    d = gcd(a, b)
    if a == b == 0:
        assert (a == b == d == 0)
    elif a == 0:
        assert (a == 0 and d == b)
    elif b == 0:
        assert (b == 0 and d == a)
    else:
        assert (a % d == 0 and b % d == 0)
コード例 #2
0
def test_gcd_known(a, b, d):
    assert gcd(a, b) == d
コード例 #3
0
def test_gcd_commutative(a, b):
    assert gcd(a, b) == gcd(b, a)
コード例 #4
0
def test_gcd_ret_type(a, b):
    assert_is_integer(gcd(a, b))