[ { "name": "12 and 18", "args": [12, 18], "expect": { "gcd": 6, "lcm": 36 } }, { "name": "coprime numbers", "args": [17, 5], "expect": { "gcd": 1, "lcm": 85 } }, { "name": "equal numbers", "args": [7, 7], "expect": { "gcd": 7, "lcm": 7 } }, { "name": "one divides the other", "args": [4, 20], "expect": { "gcd": 4, "lcm": 20 } }, { "name": "one with anything", "args": [1, 999], "expect": { "gcd": 1, "lcm": 999 } }, { "name": "negatives give non-negative answers", "args": [-4, 6], "expect": { "gcd": 2, "lcm": 12 } }, { "name": "both negative", "args": [-12, -18], "expect": { "gcd": 6, "lcm": 36 } }, { "name": "zero and n: gcd is n, lcm is zero", "args": [0, 5], "expect": { "gcd": 5, "lcm": 0 } }, { "name": "zero and a negative", "args": [-9, 0], "expect": { "gcd": 9, "lcm": 0 } }, { "name": "zero and zero", "args": [0, 0], "expect": { "gcd": 0, "lcm": 0 } }, { "name": "a times b overflows even though the lcm fits: divide first", "args": [3000000021, 5000000035], "expect": { "gcd": 1000000007, "lcm": 15000000105 } }, { "name": "the largest safe integer with itself", "args": [9007199254740991, 9007199254740991], "expect": { "gcd": 9007199254740991, "lcm": 9007199254740991 } }, { "name": "an lcm beyond 2^53 - 1 is an error", "args": [9007199254740991, 9007199254740990], "expectError": "exceeds 2^53 - 1" }, { "name": "an input beyond 2^53 - 1 is an error", "args": [9007199254740992, 2], "expectError": "outside the safe integer range" }, { "name": "a fractional input is an error", "args": [1.5, 3], "expectError": "must be an integer" } ]