forked from TheAlgorithms/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbsoluteValue.test.ts
28 lines (23 loc) · 1.03 KB
/
AbsoluteValue.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { AbsoluteValue } from "../AbsoluteValue";
describe("AbsoluteValue", () => {
it("should return the absolute value of zero", () => {
const absoluteValueOfZero = AbsoluteValue(0);
expect(absoluteValueOfZero).toBe(0);
});
it("should return the absolute value of a negative integer", () => {
const absoluteValueOfNegativeInteger = AbsoluteValue(-34);
expect(absoluteValueOfNegativeInteger).toBe(34);
});
it("should return the absolute value of a positive integer", () => {
const absoluteValueOfPositiveInteger = AbsoluteValue(50);
expect(absoluteValueOfPositiveInteger).toBe(50);
});
it("should return the absolute value of a positive floating number", () => {
const absoluteValueOfPositiveFloating = AbsoluteValue(20.2034);
expect(absoluteValueOfPositiveFloating).toBe(20.2034);
});
it("should return the absolute value of a negative floating number", () => {
const absoluteValueOfNegativeFloating = AbsoluteValue(-20.2034);
expect(absoluteValueOfNegativeFloating).toBe(20.2034);
});
});