-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
61 lines (34 loc) · 1.57 KB
/
test.js
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
import sro2syllabics from './sro2syllabics.js';
import syllabics2sro from './syllabics2sro.js';
const sro = `kâ-mâci-pîkiskwâtikot ôhi oskâya ê-nêhiyawêyit. mâka namôya nisitohtawêw awa oskinikîs tânisi ê-itwêyit âta wîsta ê-nêhiyawêt.`;
const syllabics = `ᑳ ᒫᒋ ᐲᑭᐢᒁᑎᑯᐟ ᐆᐦᐃ ᐅᐢᑳᔭ ᐁ ᓀᐦᐃᔭᐍᔨᐟ᙮ ᒫᑲ ᓇᒨᔭ ᓂᓯᑐᐦᑕᐍᐤ ᐊᐘ ᐅᐢᑭᓂᑮᐢ ᑖᓂᓯ ᐁ ᐃᑘᔨᐟ ᐋᑕ ᐑᐢᑕ ᐁ ᓀᐦᐃᔭᐍᐟ᙮`;
console.info(`\nTesting SRO > Syllabics`);
const sro2syllabicsResult = sro2syllabics(sro);
console.info(`\nInput:\t${sro}`);
console.info(`Result:\t${sro2syllabicsResult}`);
console.info(`Target:\t${syllabics}`);
if (sro2syllabicsResult === syllabics) {
console.info(`\nSRO > Syllabics test passed!`);
} else {
console.error(`\nTest failed!`);
[...syllabics].forEach((letter, i) => {
if (syllabics[i] !== sro2syllabicsResult[i]) {
throw new Error(`\nMisalignment starts at: ${sro2syllabicsResult.slice(i)}`);
}
});
}
console.info(`\nTesting Syllabics > SRO`);
const syllabics2sroResult = syllabics2sro(syllabics);
console.info(`\nInput:\t${syllabics}`);
console.info(`Result:\t${syllabics2sroResult}`);
console.info(`Target:\t${sro}`);
if (syllabics2sroResult === sro) {
console.info(`\nSyllabics > SRO test passed!`);
} else {
console.error(`\nTest failed!`);
[...sro].forEach((letter, i) => {
if (sro[i] !== syllabics2sroResult[i]) {
throw new Error(`\nMisalignment starts at: ${syllabics2sroResult.slice(i)}`);
}
});
}