2150 |
mathias |
1 |
if(!dojo._hasResource["dojox.collections.tests.Queue"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
|
|
2 |
dojo._hasResource["dojox.collections.tests.Queue"] = true;
|
|
|
3 |
dojo.provide("dojox.collections.tests.Queue");
|
|
|
4 |
dojo.require("dojox.collections.Queue");
|
|
|
5 |
|
|
|
6 |
tests.register("dojox.collections.tests.Queue", [
|
|
|
7 |
function testCtor(t){
|
|
|
8 |
var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
|
|
|
9 |
t.assertEqual(4, q.count);
|
|
|
10 |
},
|
|
|
11 |
function testClear(t){
|
|
|
12 |
var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
|
|
|
13 |
q.clear();
|
|
|
14 |
t.assertEqual(0, q.count);
|
|
|
15 |
},
|
|
|
16 |
function testClone(t){
|
|
|
17 |
var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
|
|
|
18 |
var cloned=q.clone();
|
|
|
19 |
t.assertEqual(q.count, cloned.count);
|
|
|
20 |
t.assertEqual(q.toArray().join(), cloned.toArray().join());
|
|
|
21 |
},
|
|
|
22 |
function testContains(t){
|
|
|
23 |
var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
|
|
|
24 |
t.assertTrue(q.contains("bar"));
|
|
|
25 |
t.assertFalse(q.contains("faz"));
|
|
|
26 |
},
|
|
|
27 |
function testGetIterator(t){
|
|
|
28 |
var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
|
|
|
29 |
var itr=q.getIterator();
|
|
|
30 |
while(!itr.atEnd()){ itr.get(); }
|
|
|
31 |
t.assertEqual("bull", itr.element);
|
|
|
32 |
},
|
|
|
33 |
function testPeek(t){
|
|
|
34 |
var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
|
|
|
35 |
t.assertEqual("foo", q.peek());
|
|
|
36 |
},
|
|
|
37 |
function testDequeue(t){
|
|
|
38 |
var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
|
|
|
39 |
t.assertEqual("foo", q.dequeue());
|
|
|
40 |
t.assertEqual("bar,test,bull", q.toArray().join(","));
|
|
|
41 |
},
|
|
|
42 |
function testEnqueue(t){
|
|
|
43 |
var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
|
|
|
44 |
q.enqueue("bull");
|
|
|
45 |
t.assertEqual("bull", q.toArray().pop());
|
|
|
46 |
}
|
|
|
47 |
]);
|
|
|
48 |
|
|
|
49 |
}
|