From 1c5685d68f1b73270fb814fe04cbb490eb90ba5f Mon Sep 17 00:00:00 2001 From: mensonge Date: Fri, 14 Nov 2008 15:39:19 +0000 Subject: Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library) git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f --- includes/js/dojox/lang/tests/array.js | 84 -------------- includes/js/dojox/lang/tests/curry.js | 31 ----- includes/js/dojox/lang/tests/fold.js | 64 ----------- includes/js/dojox/lang/tests/fun_perf.html | 176 ----------------------------- includes/js/dojox/lang/tests/lambda.js | 24 ---- includes/js/dojox/lang/tests/listcomp.js | 28 ----- includes/js/dojox/lang/tests/main.js | 17 --- includes/js/dojox/lang/tests/misc.js | 31 ----- includes/js/dojox/lang/tests/runTests.html | 9 -- 9 files changed, 464 deletions(-) delete mode 100644 includes/js/dojox/lang/tests/array.js delete mode 100644 includes/js/dojox/lang/tests/curry.js delete mode 100644 includes/js/dojox/lang/tests/fold.js delete mode 100644 includes/js/dojox/lang/tests/fun_perf.html delete mode 100644 includes/js/dojox/lang/tests/lambda.js delete mode 100644 includes/js/dojox/lang/tests/listcomp.js delete mode 100644 includes/js/dojox/lang/tests/main.js delete mode 100644 includes/js/dojox/lang/tests/misc.js delete mode 100644 includes/js/dojox/lang/tests/runTests.html (limited to 'includes/js/dojox/lang/tests') diff --git a/includes/js/dojox/lang/tests/array.js b/includes/js/dojox/lang/tests/array.js deleted file mode 100644 index 292210c..0000000 --- a/includes/js/dojox/lang/tests/array.js +++ /dev/null @@ -1,84 +0,0 @@ -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 deleted file mode 100644 index cb6fa6a..0000000 --- a/includes/js/dojox/lang/tests/curry.js +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index e766c62..0000000 --- a/includes/js/dojox/lang/tests/fold.js +++ /dev/null @@ -1,64 +0,0 @@ -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 deleted file mode 100644 index 9d19a60..0000000 --- a/includes/js/dojox/lang/tests/fun_perf.html +++ /dev/null @@ -1,176 +0,0 @@ - - - clocking fun - - - - - - - - -

This test is meant to run with Firebug.

- - diff --git a/includes/js/dojox/lang/tests/lambda.js b/includes/js/dojox/lang/tests/lambda.js deleted file mode 100644 index 7e5e7ed..0000000 --- a/includes/js/dojox/lang/tests/lambda.js +++ /dev/null @@ -1,24 +0,0 @@ -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 deleted file mode 100644 index 45cd8ab..0000000 --- a/includes/js/dojox/lang/tests/listcomp.js +++ /dev/null @@ -1,28 +0,0 @@ -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 deleted file mode 100644 index 1f0d7ab..0000000 --- a/includes/js/dojox/lang/tests/main.js +++ /dev/null @@ -1,17 +0,0 @@ -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 deleted file mode 100644 index f17ea8c..0000000 --- a/includes/js/dojox/lang/tests/misc.js +++ /dev/null @@ -1,31 +0,0 @@ -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 deleted file mode 100644 index 32fdfdb..0000000 --- a/includes/js/dojox/lang/tests/runTests.html +++ /dev/null @@ -1,9 +0,0 @@ - - - DojoX Functional Unit Test Runner - - - -

Redirecting to D.O.H runner.

- - -- cgit v1.2.3