08_calculator:Add more test cases for subtract and power (#494)

This commit is contained in:
Damon
2024-09-23 18:09:04 +01:00
committed by GitHub
parent 7ff69d817d
commit a12f3116fd
2 changed files with 24 additions and 0 deletions
@@ -18,6 +18,14 @@ describe('subtract', () => {
test('subtracts numbers', () => {
expect(calculator.subtract(10, 4)).toBe(6);
});
test('subtracts negative numbers', () => {
expect(calculator.subtract(-10, -4)).toBe(-6);
});
test('subtracts numbers of mixed parity', () => {
expect(calculator.subtract(-8, 7)).toBe(-15);
});
});
describe('sum', () => {
@@ -52,6 +60,10 @@ describe('power', () => {
test('raises one number to the power of another number', () => {
expect(calculator.power(4, 3)).toBe(64); // 4 to third power is 64
});
test('raises one number to the power of a large number', () => {
expect(calculator.power(3, 10)).toBe(59049); // 3 to tenth power is 59049
});
});
describe('factorial', () => {