Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

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