tests/basics/int_big_cmp.py: Add more tests for big-int comparison.
To improve coverage of mpz_cmp and mpn_cmp. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
2c139bbf4e
commit
c768704cfd
|
@ -1,10 +1,13 @@
|
||||||
# test bignum comparisons
|
# test bignum comparisons
|
||||||
|
|
||||||
i = 1 << 65
|
i = 1 << 65
|
||||||
|
cases = (0, 1, -1, i, -i, i + 1, -(i + 1))
|
||||||
|
|
||||||
print(i == 0)
|
for lhs in cases:
|
||||||
print(i != 0)
|
for rhs in cases:
|
||||||
print(i < 0)
|
print("{} == {} = {}".format(lhs, rhs, lhs == rhs))
|
||||||
print(i > 0)
|
print("{} != {} = {}".format(lhs, rhs, lhs != rhs))
|
||||||
print(i <= 0)
|
print("{} < {} = {}".format(lhs, rhs, lhs < rhs))
|
||||||
print(i >= 0)
|
print("{} > {} = {}".format(lhs, rhs, lhs > rhs))
|
||||||
|
print("{} <= {} = {}".format(lhs, rhs, lhs <= rhs))
|
||||||
|
print("{} >= {} = {}".format(lhs, rhs, lhs >= rhs))
|
||||||
|
|
Loading…
Reference in New Issue