-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
38 lines (33 loc) · 1.42 KB
/
test.js
File metadata and controls
38 lines (33 loc) · 1.42 KB
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
const TP = require("./KATranslationProcessor.js")
function assertSame(engl) {
if(TP.tryAutotranslate(engl) != engl) {
console.error(`Failed to translate ${engl}`)
}
}
function assertNotTranslated(engl) {
let res = TP.tryAutotranslate(engl)
if(res != null) {
console.error(`${engl} was translated to ${res} (should not be translated)`)
}
}
// Constructed strings
assertSame("$a$")
assertSame(">$a$")
assertSame(" $b$ ")
assertSame("$c$\\n")
assertSame("$d$\\n\\n$db$ \\n")
assertNotTranslated("$d\\\\text{foo}$")
assertSame("$d\\\\text{ cm}$")
assertSame("$d\\\\text{ g}$")
assertSame("$d\\\\text{ m}$")
assertSame("$d\\\\text{cm}$")
assertSame("$d\\\\text{g}$")
assertSame("$d\\\\text{m}$")
// Real strings
assertSame("web+graphie://ka-perseus-graphie.s3.amazonaws.com/b8ca00d508c9e7b593c669977fdde31570195273")
assertSame("https://ka-perseus-images.s3.amazonaws.com/b8ca00d508c9e7b593c669977fdde31570195273.svg")
assertSame("")
assertSame("https://ka-perseus-images.s3.amazonaws.com/b8ca00d508c9e7b593c669977fdde31570195273.png")
assertSame("$\\\\blue{A_c} = \\\\pi (\\\\pink{10})^2$\\n\\n $\\\\blue{A_c} = 100\\\\pi$\\n\\n ")
assertSame(">$\\\\pink{\\\\text{m}\\\\angle D} + \\\\blue{106} = 180$")
assertSame("$3c^3-12c-8$")