(A, U, exists=None)
| 396 | |
| 397 | def test_internal_overlap_diophantine(): |
| 398 | def check(A, U, exists=None): |
| 399 | X = solve_diophantine(A, U, 0, require_ub_nontrivial=1) |
| 400 | |
| 401 | if exists is None: |
| 402 | exists = (X is not None) |
| 403 | |
| 404 | if X is not None: |
| 405 | assert_(sum(a*x for a, x in zip(A, X)) == sum(a*u//2 for a, u in zip(A, U))) |
| 406 | assert_(all(0 <= x <= u for x, u in zip(X, U))) |
| 407 | assert_(any(x != u//2 for x, u in zip(X, U))) |
| 408 | |
| 409 | if exists: |
| 410 | assert_(X is not None, repr(X)) |
| 411 | else: |
| 412 | assert_(X is None, repr(X)) |
| 413 | |
| 414 | # Smoke tests |
| 415 | check((3, 2), (2*2, 3*2), exists=True) |
no test coverage detected