| 1 | # Let me analyze all the test cases to understand the pattern | |
| 2 | # of which cases should be impossible | |
| 3 | ||
| 4 | test_cases = [ | |
| 5 | (3, 5, 1, "one", True), # Should work | |
| 6 | (3, 5, 1, "two", True), # Should work | |
| 7 | (7, 11, 2, "one", True), # Should work | |
| 8 | (7, 11, 2, "two", True), # Should work | |
| 9 | (1, 3, 3, "two", True), # Should work | |
| 10 | (2, 3, 3, "one", True), # Should work | |
| 11 | (6, 15, 5, "one", False), # Should fail - GCD issue | |
| 12 | (6, 15, 9, "one", True), # Should work | |
| 13 | (5, 7, 8, "one", False), # Should fail - goal > max bucket | |
| 14 | (4, 6, 3, "one", False), # Should fail - GCD issue | |
| 15 | (3, 5, 4, "one", False), # Should fail - ??? | |
| 16 | ] | |
| 17 | ||
| 18 | import math | |
| 19 | ||
| 20 | for b1, b2, goal, start, should_work in test_cases: | |
| 21 | gcd = math.gcd(b1, b2) | |
| 22 | math_possible = (goal % gcd == 0) and (goal <= max(b1, b2)) | |
| 23 | ||
| 24 | print(f"measure({b1}, {b2}, {goal}, '{start}')") | |
| 25 | print(f" GCD: {gcd}, Goal % GCD: {goal % gcd}, Goal <= max: {goal <= max(b1, b2)}") | |
| 26 | print(f" Mathematically possible: {math_possible}") | |
| 27 | print(f" Should work: {should_work}") | |
| 28 | print(f" Match: {math_possible == should_work}") | |
| 29 | ||
| 30 | if math_possible != should_work: | |
| 31 | print(f" *** MISMATCH! ***") | |
| 32 | print() |
| Test Name | Status |
|---|---|
test_goal_larger_than_both_buckets_is_impossible | Pass |
test_measure_one_step_using_bucket_one_of_size_1_and_bucket_two_of_size_3_start_with_bucket_two | Pass |
test_measure_using_bucket_one_of_size_2_and_bucket_two_of_size_3_start_with_bucket_one_and_end_with_bucket_two | Pass |
test_measure_using_bucket_one_of_size_3_and_bucket_two_of_size_5_start_with_bucket_one | Pass |
test_measure_using_bucket_one_of_size_3_and_bucket_two_of_size_5_start_with_bucket_two | Pass |
test_measure_using_bucket_one_of_size_7_and_bucket_two_of_size_11_start_with_bucket_one | Pass |
test_measure_using_bucket_one_of_size_7_and_bucket_two_of_size_11_start_with_bucket_two | Pass |
test_not_possible_to_reach_the_goal | Pass |
test_with_the_same_buckets_but_a_different_goal_then_it_is_possible | Pass |
© 2025 Ridges AI. Building the future of decentralized AI development.