-
Notifications
You must be signed in to change notification settings - Fork 3
/
tests
executable file
·25 lines (24 loc) · 1.92 KB
/
tests
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
#!/usr/bin/env node
var textToTinyBraille = require('./text-to-tinybraille.js');
var tests=[
{"input":"CYBERPUNK","output":"⢎⡁⠑⡔⠁⣟⠆⣟⡁⡯⡂⡯⠂⢇⡸⢸⠢⡇⡧⢎"},
{"input":"abcdefghijklmnopqrstuvwxyz.,!?():;<>\"+-'%[]{}_0123456789/\\~^", "output":"⡮⡆⣟⠆⢎⡁⣏⠆⣟⡁⡯⠁⢎⡅⡧⡇⣹⡁⢄⠇⡧⢎⢸⣀⢸⠢⢺⢸⠢⡇⢎⡱⢸⠕⠰⣩⡆⡯⡂⣊⠅⢹⠁⢇⡸⠘⢄⠜⠸⡰⡸⢨⢪⠈⢢⠊⢈⣝⡁⡀⡠⢘⠈⡑⠰⡁⡱⢐⢀⠅⢔⢐⠄⠃⠃⢴⠄⠤⠄⠃⡡⢊⢸⡁⣹⠠⣖⢐⡦⢀⣀⠰⡱⢐⣇⢨⣑⢈⡳⠰⢼⢘⡩⢰⣭⢈⠝⠰⡳⠰⢽⢀⠔⠁⠑⢄⠐⠑⠁⠊⠂"},
{"input":". .","output":"⡀ ⢀"},
{"input":"The quick brown fox jumps over the lazy dog.","output":"⢹⠁⡧⡇⣟⡁ ⠰⣩⡆⢇⡸⢈⣏⠰⣉⢸⠴⡁ ⢸⡳⢸⢕⠰⣉⠆⢇⢆⠇⡗⢼⠀ ⡯⠁⢎⡱⢨⢪⠀ ⢄⠇⢇⡸⢸⠢⢺⢸⠕⢐⡩⠀ ⢎⡱⠘⢄⠜⢸⣋⢸⢕⠀ ⢹⠁⡧⡇⣟⡁ ⢸⣀⢰⢵⢈⣝⡁⠑⡔⠁ ⢸⡱⠰⣉⠆⢎⡅⡀"},
{"input":"The wizard quickly jinxed the gnomes before they vaporized.","output":"⢹⠁⡧⡇⣟⡁ ⠸⡰⡸⢈⣏⢈⣝⡁⡮⡆⡯⡂⣏⠆ ⠰⣩⡆⢇⡸⢈⣏⠰⣉⢸⠴⡁⣇⡀⠑⡔⠁ ⠠⡸⢈⣏⢸⠢⡇⡕⡅⣟⡁⣏⠆ ⠈⡏⢸⢼⢸⣋⠀ ⢎⡅⡗⢼⠰⣉⠆⡗⠔⡇⣟⡁⣊⠅ ⢸⡳⢸⣋⢸⠍⠰⣉⠆⡯⡂⣟⡁ ⠈⡏⢸⢼⢸⣋⠈⢢⠊⠀ ⠣⡠⠃⡮⡆⡯⠂⢎⡱⢸⢕⢈⣏⢈⣝⡁⣟⡁⣏⠆⡀"},
{"input":".\n.","output":"⡀\n⡀"},
{"input":"oo","output":"⢎⡱⠰⣉⠆"},
{"input":"T T","output":"⢹⠁ ⠈⡏"},
]
for(var i in tests){
var test=tests[i];
var result=textToTinyBraille(test["input"])
if(result!=test["output"]){
console.log("test "+i+" failed");
console.log("Input : '"+test["input"]+"'");
console.log("Expected : '"+test["output"]+"'");
console.log("Actual : '"+result+"'");
process.exit();
}
}
console.log("All tests successfull");