Skip to content

Commit a647e28

Browse files
authored
Update calculator.test.js
1 parent 2a126ab commit a647e28

1 file changed

Lines changed: 0 additions & 30 deletions

File tree

app/core/calculator.test.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,3 @@ test('subtract function', () => {
2626
expect(subtract(1e+100, 1e+100)).toBe(0); // Large number subtraction
2727
});
2828

29-
test('multiply function', () => {
30-
expect(multiply(1, 2)).toBe(2);
31-
expect(multiply(2, 0)).toBe(0);
32-
expect(multiply(-2, 3)).toBe(-6);
33-
expect(multiply(0.5, 2)).toBe(1); // Floating point multiplication
34-
expect(multiply(1000, 1000)).toBe(1000000); // Large number multiplication
35-
});
36-
37-
test('divide function', () => {
38-
expect(divide(10, 2)).toBe(5);
39-
expect(divide(1, 0)).toBe("Cannot divide by 0"); // Divide by zero case
40-
expect(divide(-10, 2)).toBe(-5);
41-
expect(divide(10, -2)).toBe(-5);
42-
expect(divide(1000, 1000)).toBe(1); // Large number division
43-
expect(divide(5, "a")).toThrow(); // Invalid division input
44-
});
45-
46-
test('divide2 function', () => {
47-
expect(divide(10, 2)).toBe(5); // Valid division
48-
expect(divide(1, 0)).toBe("Cannot divide by 0"); // This tests the divide by zero scenario
49-
expect(divide(-10, 2)).toBe(-5); // Negative division
50-
expect(divide(10, -2)).toBe(-5); // Negative division with swapped operands
51-
});
52-
53-
54-
test('floating-point operations', () => {
55-
expect(add(0.1, 0.2)).toBeCloseTo(0.3, 5); // Floating point precision
56-
expect(subtract(0.3, 0.1)).toBeCloseTo(0.2, 5); // Floating point subtraction
57-
expect(multiply(0.1, 0.2)).toBeCloseTo(0.02, 5); // Floating point multiplication
58-
});

0 commit comments

Comments
 (0)