1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
ElggPriorityListTest = TestCase("ElggPriorityListTest");
ElggPriorityListTest.prototype.setUp = function() {
this.list = new elgg.ElggPriorityList();
};
ElggPriorityListTest.prototype.tearDown = function() {
this.list = null;
};
ElggPriorityListTest.prototype.testInsert = function() {
this.list.insert('foo');
assertEquals('foo', this.list.priorities_[500][0]);
this.list.insert('bar', 501);
assertEquals('foo', this.list.priorities_[501][0]);
};
ElggPriorityListTest.prototype.testInsertRespectsPriority = function() {
var values = [5, 4, 3, 2, 1, 0];
for (var i in values) {
this.list.insert(values[i], values[i]);
}
this.list.forEach(function(elem, idx)) {
assertEquals(elem, idx);
}
};
ElggPriorityListTest.prototype.testInsertHandlesDuplicatePriorities = function() {
values = [0, 1, 2, 3, 4, 5, 6, 7, 8 , 9];
for (var i in values) {
this.list.insert(values[i], values[i]/3);
}
this.list.forEach(function(elem, idx) {
assertEquals(elem, idx);
});
};
ElggPriorityListTest.prototype.testEveryDefaultsToTrue = function() {
assertTrue(this.list.every(function() {}));
};
|