source: Dev/branches/rest-dojo-ui/client/dojox/collections/tests/Set.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.1 KB
Line 
1dojo.provide("dojox.collections.tests.Set");
2dojo.require("dojox.collections.Set");
3
4(function(){
5        var dxcs=dojox.collections.Set;
6        var a = ["apple","bear","candy","donut","epiphite","frank"];
7        var b = ["bear","epiphite","google","happy","joy"];
8        tests.register("dojox.collections.tests.Set", [
9                function testUnion(t){
10                        var union=dxcs.union(a,b);
11                        t.assertEqual("apple,bear,candy,donut,epiphite,frank,google,happy,joy", union.toArray().join(','));
12                },
13                function testIntersection(t){
14                        var itsn=dxcs.intersection(a,b);
15                        t.assertEqual("bear,epiphite", itsn.toArray().join(","));
16                        t.assertEqual("bear", dxcs.intersection(["bear","apple"], ["bear"]));
17                },
18                function testDifference(t){
19                        var d=dxcs.difference(a,b);
20                        t.assertEqual("apple,candy,donut,frank",d.toArray().join(','));
21                },
22                function testIsSubSet(t){
23                        t.assertFalse(dxcs.isSubSet(a,["bear","candy"]));
24                        t.assertTrue(dxcs.isSubSet(["bear","candy"],a));
25                },
26                function testIsSuperSet(t){
27                        t.assertTrue(dxcs.isSuperSet(a,["bear","candy"]));
28                        t.assertFalse(dxcs.isSuperSet(["bear","candy"],a));
29                }
30        ]);
31})();
Note: See TracBrowser for help on using the repository browser.