OLD | NEW |
| (Empty) |
1 1.0 Single Argument Testing | |
2 The following tests every with one argument, the callback. It should print wheth
er the arrays [2, 5, 8, 1, 4] and [12, 5, 8, 1, 44] contain any numbers >= to 10
(false and true, respectively). | |
3 | |
4 false | |
5 true | |
6 | |
7 2.0 Two Argument Testing | |
8 The following tests every with two arguments, the callback and the applied "this
" object. It should print whether the arrays [2, 5, 8, 1, 4] and [12, 5, 8, 1, 4
4] contain any numbers >= 8. Both should yield "true". | |
9 | |
10 true | |
11 true | |
12 | |
13 3.0 Array Mutation Tests | |
14 These tests the affects of array mutation during execution of some. | |
15 | |
16 3.1 Array Element Removal | |
17 This test is equivalent to 1.0, with the exception that it tests whether element
s are >= 44 instead of 10, and that it removes elements from the array on each v
isit. Both should thus yield "false" since undefined is not >= to 44. | |
18 | |
19 false | |
20 false | |
21 | |
22 3.2 Array Element Addition | |
23 This test is equivalent to 1.0, with the exception that it adds elements greater
than 10 to the end of the list. However, the results should be the same as thos
e in 1.0 since some uses the original length to create the range it iterates ove
r. | |
24 | |
25 false | |
26 true | |
27 | |
28 3.3 Array Element Changing | |
29 This test is equivalent to 1.0, with the exception that it changes elements in t
he array to be > 10 in reverse order. These elements should appear in their muta
ted form when reached by every, and thus both tests should result in "true". | |
30 | |
31 true | |
32 true | |
33 | |
34 4.0 Exception Test | |
35 This test uses a function that throws an exception, and thus halts the execution
of some. There should be 2 exceptions thrown. | |
36 | |
37 Exception thrown, execution halted! | |
38 Exception thrown, execution halted! | |
39 | |
40 5.0 Wrong Type for Callback Test | |
41 This test sends in incorrect types for the callback parameter of every. An excep
tion should be thrown in each case. There should be 6 type errors (and no crashe
s!): | |
42 | |
43 TypeError: Type error | |
44 TypeError: Type error | |
45 TypeError: Type error | |
46 TypeError: Type error | |
47 TypeError: Type error | |
48 TypeError: Type error | |
49 | |
50 6.0 Early Abortion ("Short Circuiting") This test is nearly identical to 1.0, ex
cept that it prints upon every call to the designated callback function. Since s
ome aborts as soon as it finds one qualifying element, the first array should pr
int 5 times, and the second only once. | |
51 | |
52 Testing element 2... | |
53 Testing element 5... | |
54 Testing element 8... | |
55 Testing element 1... | |
56 Testing element 4... | |
57 Done with first array. | |
58 Testing element 12... | |
59 Done with second array. | |
60 | |
61 7.0 Behavior with Holes in Arrays | |
62 This test checks that the callback function is not invoked for holes in the arra
y. Five arrays are tested: | |
63 | |
64 Testing element 2... | |
65 Testing element 8... | |
66 Testing element 1... | |
67 Testing element 4... | |
68 Done with first array. | |
69 Testing element undefined... | |
70 Done with second array. | |
71 Done with third array. | |
72 Done with fourth array. | |
73 Testing element undefined... | |
74 Done with fifth array. | |
75 | |
OLD | NEW |