source: Dev/trunk/src/client/dojox/lang/tests/misc.js

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 973 bytes
RevLine 
[483]1dojo.provide("dojox.lang.tests.misc");
2
3dojo.require("dojox.lang.functional.zip");
4
5(function(){
6        var df = dojox.lang.functional, fun = df.lambda("100*a + 10*b + c");
7       
8        tests.register("dojox.lang.tests.misc", [
9                function testZip1(t){ t.assertEqual(df.zip([1, 2, 3], [4, 5, 6]), [[1, 4], [2, 5], [3, 6]]); },
10                function testZip2(t){ t.assertEqual(df.zip([1, 2], [3, 4], [5, 6]), [[1, 3, 5], [2, 4, 6]]); },
11               
12                function testUnzip1(t){ t.assertEqual(df.unzip([[1, 4], [2, 5], [3, 6]]), [[1, 2, 3], [4, 5, 6]]); },
13                function testUnzip2(t){ t.assertEqual(df.unzip([[1, 3, 5], [2, 4, 6]]), [[1, 2], [3, 4], [5, 6]]); },
14               
15                function testMixer(t){ t.assertEqual(df.mixer(fun, [1, 2, 0])(3, 1, 2), 123); },
16                function testFlip(t){ t.assertEqual(df.flip(fun)(3, 2, 1), 123); },
17               
18                function testCompose1(t){ t.assertEqual(df.lambda(["+5", "*3"])(8), 8 * 3 + 5); },
19                function testCompose2(t){ t.assertEqual(df.lambda(["+5", "*3"].reverse())(8), (8 + 5) * 3); }
20        ]);
21})();
Note: See TracBrowser for help on using the repository browser.