|
480 | 480 | expect(multiply.toString()).to.not.contain('Math');
|
481 | 481 | });
|
482 | 482 |
|
483 |
| - it('should return the product of two integers', function() { |
484 |
| - expect(multiply(2, 1)).to.equal(2 * 1); |
| 483 | + it('should return the product of two positive integers', function() { |
| 484 | + expect(multiply(1, 2)).to.equal(1 * 2); |
| 485 | + expect(multiply(2, 1)).to.equal(1 * 2); |
| 486 | + expect(multiply(5, 17)).to.equal(5 * 17); |
485 | 487 | expect(multiply(17, 5)).to.equal(17 * 5);
|
486 | 488 | expect(multiply(78, 453)).to.equal(78 * 453);
|
487 |
| - expect(multiply(-79, 82)).to.equal(-79 * 82); |
488 |
| - expect(multiply(-275, -502)).to.equal(-275 * -502); |
| 489 | + expect(multiply(453, 78)).to.equal(78 * 453); |
489 | 490 | expect(multiply(0, 32)).to.equal(0 * 32);
|
| 491 | + expect(multiply(32, 0)).to.equal(0 * 32); |
490 | 492 | expect(multiply(0, 0)).to.equal(0 * 0);
|
491 | 493 | });
|
492 | 494 |
|
| 495 | + it('should return the product of two negative integers', function() { |
| 496 | + expect(multiply(-79, -82)).to.equal(-79 * -82); |
| 497 | + expect(multiply(-275, -502)).to.equal(-275 * -502); |
| 498 | + expect(multiply(-2, -2)).to.equal(-2 * -2); |
| 499 | + expect(multiply(-8, -3)).to.equal(-8 * -3); |
| 500 | + expect(multiply(-12, -10)).to.equal(-12 * -10); |
| 501 | + expect(multiply(-22, -3)).to.equal(-22 * -3); |
| 502 | + expect(multiply(-5, -27)).to.equal(-5 * -27); |
| 503 | + }); |
| 504 | + |
| 505 | + it('should return the product of mixed positive and negative integers', function() { |
| 506 | + expect(multiply(-79, 82)).to.equal(-79 * 82); |
| 507 | + expect(multiply(79, -82)).to.equal(79 * -82); |
| 508 | + expect(multiply(-275, 502)).to.equal(-275 * 502); |
| 509 | + expect(multiply(275, -502)).to.equal(275 * -502); |
| 510 | + expect(multiply(2, -2)).to.equal(2 * -2); |
| 511 | + expect(multiply(-8, 3)).to.equal(-8 * 3); |
| 512 | + expect(multiply(12, -10)).to.equal(12 * -10); |
| 513 | + expect(multiply(-22, 3)).to.equal(-22 * 3); |
| 514 | + expect(multiply(5, -27)).to.equal(5 * -27); |
| 515 | + }); |
| 516 | + |
493 | 517 | it('should use recursion by calling self', function () {
|
494 | 518 | var originalMultiply = multiply;
|
495 | 519 | multiply = sinon.spy(multiply);
|
|
0 commit comments