forked from brix/crypto-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpad-iso97971-test.js
35 lines (26 loc) · 1.2 KB
/
pad-iso97971-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
YUI.add('pad-iso97971-test', function (Y) {
var C = CryptoJS;
Y.Test.Runner.add(new Y.Test.Case({
name: 'Iso97971',
testPad1: function () {
var data = C.lib.WordArray.create([0xdddddd00], 3);
C.pad.Iso97971.pad(data, 1);
Y.Assert.areEqual(C.lib.WordArray.create([0xdddddd80]).toString(), data.toString());
},
testPad2: function () {
var data = C.lib.WordArray.create([0xdddddd00], 3);
C.pad.Iso97971.pad(data, 2);
Y.Assert.areEqual(C.lib.WordArray.create([0xdddddd80, 0x00000000]).toString(), data.toString());
},
testPadClamp: function () {
var data = C.lib.WordArray.create([0xdddddddd, 0xdddddddd], 3);
C.pad.Iso97971.pad(data, 2);
Y.Assert.areEqual(C.lib.WordArray.create([0xdddddd80, 0x00000000]).toString(), data.toString());
},
testUnpad: function () {
var data = C.lib.WordArray.create([0xdddddd80, 0x00000000]);
C.pad.Iso97971.unpad(data);
Y.Assert.areEqual(C.lib.WordArray.create([0xdddddd00], 3).toString(), data.toString());
}
}));
}, '$Rev$');