Skip to content

Instantly share code, notes, and snippets.

@cmstead
Last active October 1, 2017 19:53
Show Gist options
  • Save cmstead/aa3e3bb2c85e7b8915f65913662279e4 to your computer and use it in GitHub Desktop.
Save cmstead/aa3e3bb2c85e7b8915f65913662279e4 to your computer and use it in GitHub Desktop.
Example of testing composite multiplyThenDivide, many cases
describe('multiplyThenDivide', function() {
it('should return 0 when multiplying by 0, dividing by 2', function() {
assert.equal(multiplyThenDivide(0, 1, 2), 0);
});
it('should return half of value when multiplying by 5, dividing by 2', function() {
assert.equal(multiplyThenDivide(1, 5, 2), 2.5);
});
it('should return the correct result when two numbers are multiplied, dividing by 3', function() {
assert.equal(multiplyThenDivide(6, 7, 3), 14);
});
it('should return a negative result when a positive and negative are multiplied together', function() {
assert.equal(multiplyThenDivide(-3, 4, 6), -2);
});
it('should return a positive result when two negative numbers are multiplied', function() {
assert.equal(multiplyThenDivide(-5, -6, 3), 10);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment