()
| 64 | |
| 65 | |
| 66 | def test_safe_binop(): |
| 67 | # Test checked arithmetic routines |
| 68 | |
| 69 | ops = [ |
| 70 | (operator.add, 1), |
| 71 | (operator.sub, 2), |
| 72 | (operator.mul, 3) |
| 73 | ] |
| 74 | |
| 75 | with exc_iter(ops, INT64_VALUES, INT64_VALUES) as it: |
| 76 | for xop, a, b in it: |
| 77 | pyop, op = xop |
| 78 | c = pyop(a, b) |
| 79 | |
| 80 | if not (INT64_MIN <= c <= INT64_MAX): |
| 81 | assert_raises(OverflowError, mt.extint_safe_binop, a, b, op) |
| 82 | else: |
| 83 | d = mt.extint_safe_binop(a, b, op) |
| 84 | if c != d: |
| 85 | # assert_equal is slow |
| 86 | assert_equal(d, c) |
| 87 | |
| 88 | |
| 89 | def test_to_128(): |
nothing calls this directly
no test coverage detected