-
Notifications
You must be signed in to change notification settings - Fork 0
/
is_numeric.test.ts
42 lines (32 loc) · 1022 Bytes
/
is_numeric.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { assertEquals } from "./deps.ts";
import { isNumeric } from "./is_numeric.ts";
Deno.test("Empty String is numeric", () => {
assertEquals(isNumeric(""), true);
});
Deno.test("Space is not numeric", () => {
assertEquals(isNumeric(" "), false);
});
Deno.test("Lowercase letters is not numeric", () => {
assertEquals(isNumeric("abcdefghijklmnopqrstuvwxyz"), false);
});
Deno.test("Uppercase letters is not numeric", () => {
assertEquals(isNumeric("ABCDEFGHIJKLMNOPQRSTUVWXYZ"), false);
});
Deno.test("10 is numeric", () => {
assertEquals(isNumeric("10"), true);
});
Deno.test("10.0 is not numeric", () => {
assertEquals(isNumeric("10.0"), false);
});
Deno.test("-10 is not numeric", () => {
assertEquals(isNumeric("-10"), false);
});
Deno.test("-10.0 is not numeric", () => {
assertEquals(isNumeric("-10.0"), false);
});
Deno.test("10. is not numeric", () => {
assertEquals(isNumeric("10."), false);
});
Deno.test("10. is not numeric", () => {
assertEquals(isNumeric("-10."), false);
});