]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dojox/collections/tests/Set.js
add Dojo 1.1.1
[eow] / static / dojo-release-1.1.1 / dojox / collections / tests / Set.js
1 if(!dojo._hasResource["dojox.collections.tests.Set"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.collections.tests.Set"] = true;
3 dojo.provide("dojox.collections.tests.Set");
4 dojo.require("dojox.collections.Set");
5
6 (function(){
7         var dxcs=dojox.collections.Set;
8         var a = ["apple","bear","candy","donut","epiphite","frank"];
9         var b = ["bear","epiphite","google","happy","joy"];
10         tests.register("dojox.collections.tests.Set", [
11                 function testUnion(t){
12                         var union=dxcs.union(a,b);
13                         t.assertEqual("apple,bear,candy,donut,epiphite,frank,google,happy,joy", union.toArray().join(','));
14                 },
15                 function testIntersection(t){
16                         var itsn=dxcs.intersection(a,b);
17                         t.assertEqual("bear,epiphite", itsn.toArray().join(","));
18                         t.assertEqual("bear", dxcs.intersection(["bear","apple"], ["bear"]));
19                 },
20                 function testDifference(t){
21                         var d=dxcs.difference(a,b);
22                         t.assertEqual("apple,candy,donut,frank",d.toArray().join(','));
23                 },
24                 function testIsSubSet(t){
25                         t.assertFalse(dxcs.isSubSet(a,["bear","candy"]));
26                         t.assertTrue(dxcs.isSubSet(["bear","candy"],a));
27                 },
28                 function testIsSuperSet(t){
29                         t.assertTrue(dxcs.isSuperSet(a,["bear","candy"]));
30                         t.assertFalse(dxcs.isSuperSet(["bear","candy"],a));
31                 }
32         ]);
33 })();
34
35 }