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");
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(','));
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"]));
20 function testDifference(t){
21 var d=dxcs.difference(a,b);
22 t.assertEqual("apple,candy,donut,frank",d.toArray().join(','));
24 function testIsSubSet(t){
25 t.assertFalse(dxcs.isSubSet(a,["bear","candy"]));
26 t.assertTrue(dxcs.isSubSet(["bear","candy"],a));
28 function testIsSuperSet(t){
29 t.assertTrue(dxcs.isSuperSet(a,["bear","candy"]));
30 t.assertFalse(dxcs.isSuperSet(["bear","candy"],a));