diff --git a/test/function/arithmetic/lcm.test.js b/test/function/arithmetic/lcm.test.js index 20060a855..61378eeb2 100644 --- a/test/function/arithmetic/lcm.test.js +++ b/test/function/arithmetic/lcm.test.js @@ -77,6 +77,17 @@ describe('lcm', function() { assert.throws(function () {lcm('a', 2); }, /Cannot convert "a" to a number/); }); + it('should find the least common multiple of fractions', function () { + var a = math.fraction(5,8); + assert.equal(lcm(a, math.fraction(3,7)).toString(), '15'); + assert.equal(a.toString(), '0.625'); + }); + + it('should find the least common multiple of mixed numbers and fractions', function () { + assert.deepEqual(lcm(math.fraction(12), 8), math.fraction(24)); + assert.deepEqual(lcm(12, math.fraction(8)), math.fraction(24)); + }); + it('should throw an error with units', function() { assert.throws(function () { lcm(math.unit('5cm'), 2); }, TypeError, 'Function lcm(unit, number) not supported'); });