-
Notifications
You must be signed in to change notification settings - Fork 9
/
test.js
46 lines (35 loc) · 1.05 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
describe('word count', function() {
var count = require('./');
function assert(a, b) {
if (a !== b) {
throw new Error(a + ' not equal ' + b);
}
}
it('should count CJK at end', function() {
assert(count('this is 中文'), 4);
});
it('should count CJK at start', function() {
assert(count('中文is this'), 4);
});
it('should count CJK mix', function() {
assert(count('this中文is a 单词'), 7);
});
it('should count Arabic', function() {
assert(count('سلام سلام.'), 2);
});
it('should count Arabic and English', function() {
assert(count('this لغة'), 2);
});
it('should count Arabic 3 words', function() {
assert(count('داد فارسی ۱۲۳۱۲۳'), 3);
});
it('should count Cyrillic and English', function() {
assert(count('this это'), 2);
});
it('should count Cyrillic 3 words', function() {
assert(count('три образца слова'), 3);
});
it('should count 0 words', function() {
assert(count('"- - - - - - - - - - - - - -"'), 0);
});
});