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");
6 tests.register("dojox.collections.tests.Queue", [
8 var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
9 t.assertEqual(4, q.count);
11 function testClear(t){
12 var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
14 t.assertEqual(0, q.count);
16 function testClone(t){
17 var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
19 t.assertEqual(q.count, cloned.count);
20 t.assertEqual(q.toArray().join(), cloned.toArray().join());
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"));
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);
34 var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
35 t.assertEqual("foo", q.peek());
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(","));
42 function testEnqueue(t){
43 var q=new dojox.collections.Queue(["foo","bar","test","bull"]);
45 t.assertEqual("bull", q.toArray().pop());