Last change
on this file since 256 was
256,
checked in by hendrikvanantwerpen, 13 years ago
|
Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).
|
File size:
961 bytes
|
Line | |
---|
1 | define(['doh', '../ascii85'], function(doh, dca){ |
---|
2 | var msg1 = "The rain in Spain falls mainly on the plain."; |
---|
3 | var msg2 = "The rain in Spain falls mainly on the plain.1"; |
---|
4 | var msg3 = "The rain in Spain falls mainly on the plain.ab"; |
---|
5 | var msg4 = "The rain in Spain falls mainly on the plain.!@#"; |
---|
6 | |
---|
7 | var s2b = function(s){ |
---|
8 | var b = []; |
---|
9 | for(var i = 0; i < s.length; ++i){ |
---|
10 | b.push(s.charCodeAt(i)); |
---|
11 | } |
---|
12 | return b; |
---|
13 | }; |
---|
14 | |
---|
15 | var b2s = function(b){ |
---|
16 | var s = []; |
---|
17 | dojo.forEach(b, function(c){ s.push(String.fromCharCode(c)); }); |
---|
18 | return s.join(""); |
---|
19 | }; |
---|
20 | |
---|
21 | doh.register("dojox.encoding.tests.ascii85", [ |
---|
22 | function testMsg1(t){ t.assertEqual(msg1, b2s(dca.decode(dca.encode(s2b(msg1))))); }, |
---|
23 | function testMsg2(t){ t.assertEqual(msg2, b2s(dca.decode(dca.encode(s2b(msg2))))); }, |
---|
24 | function testMsg3(t){ t.assertEqual(msg3, b2s(dca.decode(dca.encode(s2b(msg3))))); }, |
---|
25 | function testMsg4(t){ t.assertEqual(msg4, b2s(dca.decode(dca.encode(s2b(msg4))))); } |
---|
26 | ]); |
---|
27 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.