forked from brix/crypto-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenc-utf16-test.js
55 lines (42 loc) · 2.07 KB
/
enc-utf16-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
YUI.add('enc-utf16-test', function (Y) {
var C = CryptoJS;
Y.Test.Runner.add(new Y.Test.Case({
name: 'Utf16',
testStringify1: function () {
Y.Assert.areEqual('z', C.enc.Utf16.stringify(C.lib.WordArray.create([0x007a0000], 2)));
},
testStringify2: function () {
Y.Assert.areEqual('水', C.enc.Utf16.stringify(C.lib.WordArray.create([0x6c340000], 2)));
},
testStringify3: function () {
Y.Assert.areEqual('𐀀', C.enc.Utf16.stringify(C.lib.WordArray.create([0xd800dc00], 4)));
},
testStringify4: function () {
Y.Assert.areEqual('𝄞', C.enc.Utf16.stringify(C.lib.WordArray.create([0xd834dd1e], 4)));
},
testStringify5: function () {
Y.Assert.areEqual('', C.enc.Utf16.stringify(C.lib.WordArray.create([0xdbffdffd], 4)));
},
testStringifyLE: function () {
Y.Assert.areEqual('', C.enc.Utf16LE.stringify(C.lib.WordArray.create([0xffdbfddf], 4)));
},
testParse1: function () {
Y.Assert.areEqual(C.lib.WordArray.create([0x007a0000], 2).toString(), C.enc.Utf16.parse('z').toString());
},
testParse2: function () {
Y.Assert.areEqual(C.lib.WordArray.create([0x6c340000], 2).toString(), C.enc.Utf16.parse('水').toString());
},
testParse3: function () {
Y.Assert.areEqual(C.lib.WordArray.create([0xd800dc00], 4).toString(), C.enc.Utf16.parse('𐀀').toString());
},
testParse4: function () {
Y.Assert.areEqual(C.lib.WordArray.create([0xd834dd1e], 4).toString(), C.enc.Utf16.parse('𝄞').toString());
},
testParse5: function () {
Y.Assert.areEqual(C.lib.WordArray.create([0xdbffdffd], 4).toString(), C.enc.Utf16.parse('').toString());
},
testParseLE: function () {
Y.Assert.areEqual(C.lib.WordArray.create([0xffdbfddf], 4).toString(), C.enc.Utf16LE.parse('').toString());
}
}));
}, '$Rev$');