diff options
| author | Damien George <damien@micropython.org> | 2021-12-21 18:00:11 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-12-21 18:00:11 +1100 |
| commit | c768704cfdcb6dcafc0c972c6818fe4dd5b39034 (patch) | |
| tree | 890773d71bb9035aeeaaf45ba0ebabbf665b9219 | |
| parent | 2c139bbf4e5724ab253b5b034ce925e04267a9c4 (diff) | |
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>
| -rw-r--r-- | tests/basics/int_big_cmp.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/basics/int_big_cmp.py b/tests/basics/int_big_cmp.py index 7cb7412bd..d7394d3bc 100644 --- a/tests/basics/int_big_cmp.py +++ b/tests/basics/int_big_cmp.py @@ -1,10 +1,13 @@ # test bignum comparisons i = 1 << 65 +cases = (0, 1, -1, i, -i, i + 1, -(i + 1)) -print(i == 0) -print(i != 0) -print(i < 0) -print(i > 0) -print(i <= 0) -print(i >= 0) +for lhs in cases: + for rhs in cases: + print("{} == {} = {}".format(lhs, rhs, lhs == rhs)) + print("{} != {} = {}".format(lhs, rhs, lhs != rhs)) + print("{} < {} = {}".format(lhs, rhs, lhs < rhs)) + print("{} > {} = {}".format(lhs, rhs, lhs > rhs)) + print("{} <= {} = {}".format(lhs, rhs, lhs <= rhs)) + print("{} >= {} = {}".format(lhs, rhs, lhs >= rhs)) |
