diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-13 09:49:11 +0000 |
commit | e44a7e37b6c7b5961adaffc62b9042b8d442938e (patch) | |
tree | 95b67c356e93163467db2451f2b8cce84ed5d582 /includes/js/dojox/lang/tests | |
parent | a62b9742ee5e28bcec6872d88f50f25b820914f6 (diff) | |
download | semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.gz semanticscuttle-e44a7e37b6c7b5961adaffc62b9042b8d442938e.tar.bz2 |
New feature: basic Ajax suggestion for tags and implementation of Dojo toolkit
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@151 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/lang/tests')
-rw-r--r-- | includes/js/dojox/lang/tests/array.js | 84 | ||||
-rw-r--r-- | includes/js/dojox/lang/tests/curry.js | 31 | ||||
-rw-r--r-- | includes/js/dojox/lang/tests/fold.js | 64 | ||||
-rw-r--r-- | includes/js/dojox/lang/tests/fun_perf.html | 176 | ||||
-rw-r--r-- | includes/js/dojox/lang/tests/lambda.js | 24 | ||||
-rw-r--r-- | includes/js/dojox/lang/tests/listcomp.js | 28 | ||||
-rw-r--r-- | includes/js/dojox/lang/tests/main.js | 17 | ||||
-rw-r--r-- | includes/js/dojox/lang/tests/misc.js | 31 | ||||
-rw-r--r-- | includes/js/dojox/lang/tests/runTests.html | 9 |
9 files changed, 464 insertions, 0 deletions
diff --git a/includes/js/dojox/lang/tests/array.js b/includes/js/dojox/lang/tests/array.js new file mode 100644 index 0000000..292210c --- /dev/null +++ b/includes/js/dojox/lang/tests/array.js @@ -0,0 +1,84 @@ +if(!dojo._hasResource["dojox.lang.tests.array"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.lang.tests.array"] = true; +dojo.provide("dojox.lang.tests.array"); + +dojo.require("dojox.lang.functional"); +dojo.require("dojox.lang.functional.fold"); +dojo.require("dojox.lang.functional.reversed"); + +(function(){ + var df = dojox.lang.functional, v, isOdd = "%2"; + + var revArrayIter = function(array){ + this.array = array; + this.position = array.length - 1; + }; + dojo.extend(revArrayIter, { + hasNext: df.lambda("this.position >= 0"), + next: df.lambda("this.array[this.position--]") + }); + + tests.register("dojox.lang.tests.array", [ + function testFilter1(t){ t.assertEqual(df.filter([1, 2, 3], isOdd), [1, 3]); }, + function testFilter2(t){ t.assertEqual(df.filter([1, 2, 3], "%2==0"), [2]); }, + function testFilterIter(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertEqual(df.filter(iter, isOdd), [3, 1]); + }, + function testFilterRev(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertEqual(df.filter(iter, isOdd), df.filterRev([1, 2, 3], isOdd)); + }, + + function testForEach(t){ + t.assertEqual((v = [], df.forEach([1, 2, 3], function(x){ v.push(x); }), v), [1, 2, 3]); + }, + function testForEachIter(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertEqual((v = [], df.forEach(iter, function(x){ v.push(x); }), v), [3, 2, 1]); + }, + function testForEachRev(t){ + t.assertEqual((v = [], df.forEachRev([1, 2, 3], function(x){ v.push(x); }), v), [3, 2, 1]); + }, + + function testMap(t){ t.assertEqual(df.map([1, 2, 3], "+3"), [4, 5, 6]); }, + function testMapIter(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertEqual(df.map(iter, "+3"), [6, 5, 4]); + }, + function testMapRev(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertEqual(df.map(iter, "+3"), df.mapRev([1, 2, 3], "+3")); + }, + + function testEvery1(t){ t.assertFalse(df.every([1, 2, 3], isOdd)); }, + function testEvery2(t){ t.assertTrue(df.every([1, 3, 5], isOdd)); }, + function testEveryIter(t){ + var iter = new revArrayIter([1, 3, 5]); + t.assertTrue(df.every(iter, isOdd)); + }, + function testEveryRev1(t){ t.assertFalse(df.everyRev([1, 2, 3], isOdd)); }, + function testEveryRev2(t){ t.assertTrue(df.everyRev([1, 3, 5], isOdd)); }, + + function testSome1(t){ t.assertFalse(df.some([2, 4, 6], isOdd)); }, + function testSome2(t){ t.assertTrue(df.some([1, 2, 3], isOdd)); }, + function testSomeIter(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertTrue(df.some(iter, isOdd)); + }, + function testSomeRev1(t){ t.assertFalse(df.someRev([2, 4, 6], isOdd)); }, + function testSomeRev2(t){ t.assertTrue(df.someRev([1, 2, 3], isOdd)); }, + + function testReduce1(t){ t.assertEqual(df.reduce([4, 2, 1], "x-y"), 1); }, + function testReduce2(t){ t.assertEqual(df.reduce([4, 2, 1], "x-y", 8), 1); }, + function testReduceIter(t){ + var iter = new revArrayIter([1, 2, 4]); + t.assertEqual(df.reduce(iter, "x-y"), 1); + }, + + function testReduceRight1(t){ t.assertEqual(df.reduceRight([4, 2, 1], "x-y"), -5); }, + function testReduceRight2(t){ t.assertEqual(df.reduceRight([4, 2, 1], "x-y", 8), 1); } + ]); +})(); + +} diff --git a/includes/js/dojox/lang/tests/curry.js b/includes/js/dojox/lang/tests/curry.js new file mode 100644 index 0000000..cb6fa6a --- /dev/null +++ b/includes/js/dojox/lang/tests/curry.js @@ -0,0 +1,31 @@ +if(!dojo._hasResource["dojox.lang.tests.curry"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.lang.tests.curry"] = true; +dojo.provide("dojox.lang.tests.curry"); + +dojo.require("dojox.lang.functional.curry"); + +(function(){ + var df = dojox.lang.functional, add5 = df.curry("+")(5), sub3 = df.curry("_-3"), fun = df.lambda("100*a + 10*b + c"); + tests.register("dojox.lang.tests.curry", [ + function testCurry1(t){ t.assertEqual(df.curry("+")(1, 2), 3); }, + function testCurry2(t){ t.assertEqual(df.curry("+")(1)(2), 3); }, + function testCurry3(t){ t.assertEqual(df.curry("+")(1, 2, 3), 3); }, + function testCurry4(t){ t.assertEqual(add5(1), 6); }, + function testCurry5(t){ t.assertEqual(add5(3), 8); }, + function testCurry6(t){ t.assertEqual(add5(5), 10); }, + function testCurry7(t){ t.assertEqual(sub3(1), -2); }, + function testCurry8(t){ t.assertEqual(sub3(3), 0); }, + function testCurry9(t){ t.assertEqual(sub3(5), 2); }, + + function testPartial1(t){ t.assertEqual(df.partial(fun, 1, 2, 3)(), 123); }, + function testPartial2(t){ t.assertEqual(df.partial(fun, 1, 2, df.arg)(3), 123); }, + function testPartial3(t){ t.assertEqual(df.partial(fun, 1, df.arg, 3)(2), 123); }, + function testPartial4(t){ t.assertEqual(df.partial(fun, 1, df.arg, df.arg)(2, 3), 123); }, + function testPartial5(t){ t.assertEqual(df.partial(fun, df.arg, 2, 3)(1), 123); }, + function testPartial6(t){ t.assertEqual(df.partial(fun, df.arg, 2, df.arg)(1, 3), 123); }, + function testPartial7(t){ t.assertEqual(df.partial(fun, df.arg, df.arg, 3)(1, 2), 123); }, + function testPartial8(t){ t.assertEqual(df.partial(fun, df.arg, df.arg, df.arg)(1, 2, 3), 123); } + ]); +})(); + +} diff --git a/includes/js/dojox/lang/tests/fold.js b/includes/js/dojox/lang/tests/fold.js new file mode 100644 index 0000000..e766c62 --- /dev/null +++ b/includes/js/dojox/lang/tests/fold.js @@ -0,0 +1,64 @@ +if(!dojo._hasResource["dojox.lang.tests.fold"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.lang.tests.fold"] = true; +dojo.provide("dojox.lang.tests.fold"); + +dojo.require("dojox.lang.functional.fold"); +dojo.require("dojox.lang.functional.scan"); +dojo.require("dojox.lang.functional.curry"); + +(function(){ + var df = dojox.lang.functional, a = df.arg; + + var revArrayIter = function(array){ + this.array = array; + this.position = array.length - 1; + }; + dojo.extend(revArrayIter, { + hasNext: df.lambda("this.position >= 0"), + next: df.lambda("this.array[this.position--]") + }); + + tests.register("dojox.lang.tests.fold", [ + function testFoldl1(t){ t.assertEqual(df.foldl([1, 2, 3], "+", 0), 6); }, + function testFoldl2(t){ t.assertEqual(df.foldl1([1, 2, 3], "*"), 6); }, + function testFoldl3(t){ t.assertEqual(df.foldl1([1, 2, 3], "/"), 1/6); }, + function testFoldl4(t){ t.assertEqual(df.foldl1([1, 2, 3], df.partial(Math.max, a, a)), 3); }, + function testFoldl5(t){ t.assertEqual(df.foldl1([1, 2, 3], df.partial(Math.min, a, a)), 1); }, + + function testFoldlIter(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertEqual(df.foldl(iter, "+", 0), 6); + }, + function testFoldl1Iter(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertEqual(df.foldl1(iter, "/"), 3/2); + }, + + function testFoldr1(t){ t.assertEqual(df.foldr([1, 2, 3], "+", 0), 6); }, + function testFoldr2(t){ t.assertEqual(df.foldr1([1, 2, 3], "*"), 6); }, + function testFoldr3(t){ t.assertEqual(df.foldr1([1, 2, 3], "/"), 3/2); }, + function testFoldr4(t){ t.assertEqual(df.foldr1([1, 2, 3], df.partial(Math.max, a, a)), 3); }, + function testFoldr5(t){ t.assertEqual(df.foldr1([1, 2, 3], df.partial(Math.min, a, a)), 1); }, + + function testScanl1(t){ t.assertEqual(df.scanl([1, 2, 3], "+", 0), [0, 1, 3, 6]); }, + function testScanl2(t){ t.assertEqual(df.scanl1([1, 2, 3], "*"), [1, 2, 6]); }, + function testScanl3(t){ t.assertEqual(df.scanl1([1, 2, 3], df.partial(Math.max, a, a)), [1, 2, 3]); }, + function testScanl4(t){ t.assertEqual(df.scanl1([1, 2, 3], df.partial(Math.min, a, a)), [1, 1, 1]); }, + + function testScanlIter(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertEqual(df.scanl(iter, "+", 0), [0, 3, 5, 6]); + }, + function testScanl1Iter(t){ + var iter = new revArrayIter([1, 2, 3]); + t.assertEqual(df.scanl1(iter, "*"), [3, 6, 6]); + }, + + function testScanr1(t){ t.assertEqual(df.scanr([1, 2, 3], "+", 0), [6, 5, 3, 0]); }, + function testScanr2(t){ t.assertEqual(df.scanr1([1, 2, 3], "*"), [6, 6, 3]); }, + function testScanr3(t){ t.assertEqual(df.scanr1([1, 2, 3], df.partial(Math.max, a, a)), [3, 3, 3]); }, + function testScanr4(t){ t.assertEqual(df.scanr1([1, 2, 3], df.partial(Math.min, a, a)), [1, 2, 3]); } + ]); +})(); + +} diff --git a/includes/js/dojox/lang/tests/fun_perf.html b/includes/js/dojox/lang/tests/fun_perf.html new file mode 100644 index 0000000..9d19a60 --- /dev/null +++ b/includes/js/dojox/lang/tests/fun_perf.html @@ -0,0 +1,176 @@ +<html> + <head> + <title>clocking fun</title> + <style type="text/css"> + @import "../../../dojo/resources/dojo.css"; + </style> + <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true"></script> + <script type="text/javascript" src="../functional.js"></script> + <script type="text/javascript" src="../functional/sequence.js"></script> + <script type="text/javascript" src="../functional/fold.js"></script> + <script type="text/javascript"> + dojo.addOnLoad(function(){ + var LEN = 2000, ITER = 200, b, e, tests = {}, + df = dojox.lang.functional, + sample = df.repeat(LEN, "+1", 0), + add = df.lambda("+"), + isOdd = df.lambda("%2"); + + var clock = function(body){ + var b = new Date(); + body(); + var e = new Date(); + return e.getTime() - b.getTime(); // in ms + }; + + var log = function(name, body){ + b = new Date(); + var ms = clock(body); + e = new Date(); + console.log(name + ":", ms); + }; + + // filter + tests["raw filter"] = function(){ + for(var i = 0; i < ITER; ++i){ + var t = []; + for(var j = 0; j < sample.length; ++j){ + if(isOdd(sample[j])){ t.push(sample[j]); } + } + } + }; + tests["dojo.filter"] = function(){ + for(var i = 0; i < ITER; ++i){ + dojo.filter(sample, isOdd); + } + }; + tests["df.filter"] = function(){ + for(var i = 0; i < ITER; ++i){ + df.filter(sample, isOdd); + } + }; + if(sample.filter){ + tests["Array.prototype.filter"] = function(){ + for(var i = 0; i < ITER; ++i){ + sample.filter(isOdd); + } + }; + } + + // map + tests["raw map"] = function(){ + for(var i = 0; i < ITER; ++i){ + var t = []; + for(var j = 0; j < sample.length; ++j){ + t.push(isOdd(sample[j])); + } + } + }; + tests["dojo.map"] = function(){ + for(var i = 0; i < ITER; ++i){ + dojo.map(sample, isOdd); + } + }; + tests["df.map"] = function(){ + for(var i = 0; i < ITER; ++i){ + df.map(sample, isOdd); + } + }; + if(sample.map){ + tests["Array.prototype.map"] = function(){ + for(var i = 0; i < ITER; ++i){ + sample.map(isOdd); + } + }; + } + + // forEach + tests["raw forEach"] = function(){ + for(var i = 0; i < ITER; ++i){ + for(var j = 0; j < sample.length; ++j){ + isOdd(sample[j]); + } + } + }; + tests["dojo.forEach"] = function(){ + for(var i = 0; i < ITER; ++i){ + dojo.forEach(sample, isOdd); + } + }; + tests["df.forEach"] = function(){ + for(var i = 0; i < ITER; ++i){ + df.forEach(sample, isOdd); + } + }; + if(sample.forEach){ + tests["Array.prototype.forEach"] = function(){ + for(var i = 0; i < ITER; ++i){ + sample.forEach(isOdd); + } + }; + } + + // reduce + tests["raw reduce"] = function(){ + for(var i = 0; i < ITER; ++i){ + var z = 0; + for(var j = 0; j < sample.length; ++j){ + z = add(z, sample[j]); + } + } + }; + tests["df.reduce"] = function(){ + for(var i = 0; i < ITER; ++i){ + df.reduce(sample, add, 0); + } + }; + if(sample.reduce){ + tests["Array.prototype.reduce"] = function(){ + for(var i = 0; i < ITER; ++i){ + sample.reduce(add, 0); + } + }; + } + + // reduceRight + tests["raw reduceRight"] = function(){ + for(var i = 0; i < ITER; ++i){ + var z = 0; + for(var j = sample.length - 1; j >= 0; --j){ + z = add(z, sample[j]); + } + } + }; + tests["df.reduceRight"] = function(){ + for(var i = 0; i < ITER; ++i){ + df.reduceRight(sample, add, 0); + } + }; + if(sample.reduceRight){ + tests["Array.prototype.reduceRight"] = function(){ + for(var i = 0; i < ITER; ++i){ + sample.reduceRight(add, 0); + } + }; + } + + var keys = df.keys(tests), i = 0; + + var doTest = function(){ + log(keys[i], tests[keys[i]]); + ++i; + if(i < keys.length){ + setTimeout(doTest, 1); + }else{ + console.log("that's all"); + } + }; + + setTimeout(doTest, 1); + }); + </script> + </head> + <body> + <p>This test is meant to run with Firebug.</p> + </body> +</html> diff --git a/includes/js/dojox/lang/tests/lambda.js b/includes/js/dojox/lang/tests/lambda.js new file mode 100644 index 0000000..7e5e7ed --- /dev/null +++ b/includes/js/dojox/lang/tests/lambda.js @@ -0,0 +1,24 @@ +if(!dojo._hasResource["dojox.lang.tests.lambda"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.lang.tests.lambda"] = true; +dojo.provide("dojox.lang.tests.lambda"); + +dojo.require("dojox.lang.functional"); +dojo.require("dojox.lang.functional.sequence"); + +(function(){ + var df = dojox.lang.functional; + tests.register("dojox.lang.tests.lambda", [ + function testLambda1(t){ t.assertEqual(df.repeat(3, "3*", 1), [1, 3, 9]); }, + function testLambda2(t){ t.assertEqual(df.repeat(3, "*3", 1), [1, 3, 9]); }, + function testLambda3(t){ t.assertEqual(df.repeat(3, "_*3", 1), [1, 3, 9]); }, + function testLambda4(t){ t.assertEqual(df.repeat(3, "3*_", 1), [1, 3, 9]); }, + function testLambda5(t){ t.assertEqual(df.repeat(3, "n->n*3", 1), [1, 3, 9]); }, + function testLambda6(t){ t.assertEqual(df.repeat(3, "n*3", 1), [1, 3, 9]); }, + function testLambda7(t){ t.assertEqual(df.repeat(3, "3*m", 1), [1, 3, 9]); }, + function testLambda8(t){ t.assertEqual(df.repeat(3, "->1", 1), [1, 1, 1]); }, + function testLambda9(t){ t.assertEqual(df.repeat(3, function(n){ return n * 3; }, 1), [1, 3, 9]); }, + function testLambda10(t){ t.assertEqual(df.repeat(3, ["_-1", ["*3"]], 1), [1, 2, 5]); } + ]); +})(); + +} diff --git a/includes/js/dojox/lang/tests/listcomp.js b/includes/js/dojox/lang/tests/listcomp.js new file mode 100644 index 0000000..45cd8ab --- /dev/null +++ b/includes/js/dojox/lang/tests/listcomp.js @@ -0,0 +1,28 @@ +if(!dojo._hasResource["dojox.lang.tests.listcomp"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.lang.tests.listcomp"] = true; +dojo.provide("dojox.lang.tests.listcomp"); + +dojo.require("dojox.lang.functional.listcomp"); +dojo.require("dojox.lang.functional.sequence"); + +(function(){ + var df = dojox.lang.functional; + tests.register("dojox.lang.tests.listcomp", [ + function testIterator1(t){ t.assertEqual(df.repeat(3, function(n){ return n + 1; }, 0), [0, 1, 2]); }, + function testIterator2(t){ t.assertEqual(df.repeat(3, function(n){ return n * 3; }, 1), [1, 3, 9]); }, + function testIterator3(t){ t.assertEqual(df.until(function(n){ return n > 10; }, function(n){ return n * 3; }, 1), [1, 3, 9]); }, + + function testListcomp1(t){ t.assertEqual(df.listcomp("i for(var i=0; i<3; ++i)"), [0, 1, 2]); }, + function testListcomp2(t){ t.assertEqual(df.listcomp("i*j for(var i=0; i<3; ++i) for(var j=0; j<3; ++j)"), [0, 0, 0, 0, 1, 2, 0, 2, 4]); }, + function testListcomp3(t){ t.assertEqual(df.listcomp("i*j for(var i=0; i<3; ++i) if(i%2==1) for(var j=0; j<3; ++j)"), [0, 1, 2]); }, + function testListcomp4(t){ t.assertEqual(df.listcomp("i+j for(var i=0; i<3; ++i) for(var j=0; j<3; ++j)"), [0, 1, 2, 1, 2, 3, 2, 3, 4]); }, + function testListcomp5(t){ t.assertEqual(df.listcomp("i+j for(var i=0; i<3; ++i) if(i%2==1) for(var j=0; j<3; ++j)"), [1, 2, 3]); }, + function testListcomp6(t){ t.assertEqual(df.listcomp("i for(i=0; i<3; ++i)"), [0, 1, 2]); }, + function testListcomp7(t){ t.assertEqual(df.listcomp("i*j for(i=0; i<3; ++i) for(j=0; j<3; ++j)"), [0, 0, 0, 0, 1, 2, 0, 2, 4]); }, + function testListcomp8(t){ t.assertEqual(df.listcomp("i*j for(i=0; i<3; ++i) if(i%2==1) for(j=0; j<3; ++j)"), [0, 1, 2]); }, + function testListcomp9(t){ t.assertEqual(df.listcomp("i+j for(i=0; i<3; ++i) for(j=0; j<3; ++j)"), [0, 1, 2, 1, 2, 3, 2, 3, 4]); }, + function testListcomp10(t){ t.assertEqual(df.listcomp("i+j for(i=0; i<3; ++i) if(i%2==1) for(j=0; j<3; ++j)"), [1, 2, 3]); } + ]); +})(); + +} diff --git a/includes/js/dojox/lang/tests/main.js b/includes/js/dojox/lang/tests/main.js new file mode 100644 index 0000000..1f0d7ab --- /dev/null +++ b/includes/js/dojox/lang/tests/main.js @@ -0,0 +1,17 @@ +if(!dojo._hasResource["dojox.lang.tests.main"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.lang.tests.main"] = true; +dojo.provide("dojox.lang.tests.main"); + +try{ + // functional block + dojo.require("dojox.lang.tests.listcomp"); + dojo.require("dojox.lang.tests.lambda"); + dojo.require("dojox.lang.tests.fold"); + dojo.require("dojox.lang.tests.curry"); + dojo.require("dojox.lang.tests.misc"); + dojo.require("dojox.lang.tests.array"); +}catch(e){ + doh.debug(e); +} + +} diff --git a/includes/js/dojox/lang/tests/misc.js b/includes/js/dojox/lang/tests/misc.js new file mode 100644 index 0000000..f17ea8c --- /dev/null +++ b/includes/js/dojox/lang/tests/misc.js @@ -0,0 +1,31 @@ +if(!dojo._hasResource["dojox.lang.tests.misc"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. +dojo._hasResource["dojox.lang.tests.misc"] = true; +dojo.provide("dojox.lang.tests.misc"); + +dojo.require("dojox.lang.functional.object"); +dojo.require("dojox.lang.functional.zip"); + +(function(){ + var df = dojox.lang.functional, fun = df.lambda("100*a + 10*b + c"), result = []; + df.forIn({a: 1, b: 2}, function(v, i){ result.push("[" + i + "] = " + v); }); + + tests.register("dojox.lang.tests.misc", [ + function testZip1(t){ t.assertEqual(df.zip([1, 2, 3], [4, 5, 6]), [[1, 4], [2, 5], [3, 6]]); }, + function testZip2(t){ t.assertEqual(df.zip([1, 2], [3, 4], [5, 6]), [[1, 3, 5], [2, 4, 6]]); }, + + function testUnzip1(t){ t.assertEqual(df.unzip([[1, 4], [2, 5], [3, 6]]), [[1, 2, 3], [4, 5, 6]]); }, + function testUnzip2(t){ t.assertEqual(df.unzip([[1, 3, 5], [2, 4, 6]]), [[1, 2], [3, 4], [5, 6]]); }, + + function testMixer(t){ t.assertEqual(df.mixer(fun, [1, 2, 0])(3, 1, 2), 123); }, + function testFlip(t){ t.assertEqual(df.flip(fun)(3, 2, 1), 123); }, + + function testCompose1(t){ t.assertEqual(df.lambda(["+5", "*3"])(8), 8 * 3 + 5); }, + function testCompose2(t){ t.assertEqual(df.lambda(["+5", "*3"].reverse())(8), (8 + 5) * 3); }, + + function testForIn(t){ t.assertEqual(result.sort().join(", "), "[a] = 1, [b] = 2"); }, + function testKeys(t){ t.assertEqual(df.keys({a: 1, b: 2, c: 3}), ["a", "b", "c"]); }, + function testValues(t){ t.assertEqual(df.values({a: 1, b: 2, c: 3}), [1, 2, 3]); } + ]); +})(); + +} diff --git a/includes/js/dojox/lang/tests/runTests.html b/includes/js/dojox/lang/tests/runTests.html new file mode 100644 index 0000000..32fdfdb --- /dev/null +++ b/includes/js/dojox/lang/tests/runTests.html @@ -0,0 +1,9 @@ +<html>
+ <head>
+ <title>DojoX Functional Unit Test Runner</title>
+ <meta http-equiv="REFRESH" content="0;url=../../../util/doh/runner.html?testModule=dojox.lang.tests.main" /> + </head>
+ <body>
+ <p>Redirecting to D.O.H runner.</p>
+ </body>
+</html> |