-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
get_pixel_positions_test.ts
87 lines (81 loc) · 1.68 KB
/
get_pixel_positions_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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { assertEquals } from "@std/assert";
import {
getCharacterArray,
getEncodedCharacter,
getPixelPositions,
} from "./get_pixel_positions.ts";
Deno.test("[getCharacterArray] 'a'", () => {
const pixelPositions = getCharacterArray("a");
assertEquals(
pixelPositions,
[[2, 5], [2, 4, 6], [3, 4, 5, 6], []],
);
});
Deno.test("[getCharacterArray] 'あ'", () => {
const pixelPositions = getCharacterArray("あ");
assertEquals(
pixelPositions,
[
[4, 5],
[1, 3, 6],
[0, 1, 2, 3, 4, 5, 6],
[1, 3, 5],
[1, 3, 4],
[1, 3, 6],
[4, 5],
[],
],
);
});
Deno.test("[getCharacterArray] undefined character", () => {
const pixelPositions = getCharacterArray("Ω");
assertEquals(
pixelPositions,
[[], [3], [], []],
);
});
Deno.test("[getPixelPositions] 'aあΩ'", () => {
const pixelPositions = getPixelPositions("aあΩ");
assertEquals(
pixelPositions,
[
[2, 5],
[2, 4, 6],
[3, 4, 5, 6],
[],
[4, 5],
[1, 3, 6],
[0, 1, 2, 3, 4, 5, 6],
[1, 3, 5],
[1, 3, 4],
[1, 3, 6],
[4, 5],
[],
[],
[3],
[],
[],
],
);
});
Deno.test("[getEncodedCharacter] 'a'", () => {
const encodedCharacter = getEncodedCharacter("a");
assertEquals(
encodedCharacter,
"25/246/3456",
);
});
Deno.test("[getEncodedCharacter] 'あ'", () => {
const encodedCharacter = getEncodedCharacter("あ");
assertEquals(
encodedCharacter,
"45/136/0123456/135/134/136/45",
);
});
Deno.test("[getEncodedCharacter] 'Ω'", () => {
const encodedCharacter = getEncodedCharacter("Ω");
assertEquals(
encodedCharacter,
"/3/",
);
});