Debian Codegraph @

dojox/lang/tests/misc.js

raw symbols SCIP
1 dojo.provide("dojox.lang.tests.misc");
2
3 dojo.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 })();