|
1 function zero(...rest) |
|
2 { |
|
3 assertEq(rest.length, 0, "zero rest wrong length"); |
|
4 } |
|
5 |
|
6 function tzero() |
|
7 { |
|
8 zero(); |
|
9 } |
|
10 |
|
11 tzero(); tzero(); tzero(); |
|
12 |
|
13 function one(...rest) |
|
14 { |
|
15 assertEq(rest.length, 1, "one rest wrong length"); |
|
16 } |
|
17 |
|
18 function tone() |
|
19 { |
|
20 one(0); |
|
21 } |
|
22 |
|
23 tone(); tone(); tone(); |
|
24 |
|
25 function two(...rest) |
|
26 { |
|
27 assertEq(rest.length, 2, "two rest wrong length"); |
|
28 } |
|
29 |
|
30 function ttwo() |
|
31 { |
|
32 two(0, 1); |
|
33 } |
|
34 |
|
35 ttwo(); ttwo(); ttwo(); |
|
36 |
|
37 function zeroWithLeading0(x, ...rest) |
|
38 { |
|
39 assertEq(rest.length, 0, "zeroWithLeading0 rest wrong length"); |
|
40 } |
|
41 |
|
42 function tzeroWithLeading0() |
|
43 { |
|
44 zeroWithLeading0(); |
|
45 } |
|
46 |
|
47 tzeroWithLeading0(); tzeroWithLeading0(); tzeroWithLeading0(); |
|
48 |
|
49 function zeroWithLeading1(x, ...rest) |
|
50 { |
|
51 assertEq(rest.length, 0, "zeroWithLeading1 rest wrong length"); |
|
52 } |
|
53 |
|
54 function tzeroWithLeading1() |
|
55 { |
|
56 zeroWithLeading1(0); |
|
57 } |
|
58 |
|
59 tzeroWithLeading1(); tzeroWithLeading1(); tzeroWithLeading1(); |
|
60 |
|
61 function oneWithLeading(x, ...rest) |
|
62 { |
|
63 assertEq(rest.length, 1, "oneWithLeading rest wrong length"); |
|
64 } |
|
65 |
|
66 function toneWithLeading() |
|
67 { |
|
68 oneWithLeading(0, 1); |
|
69 } |
|
70 |
|
71 toneWithLeading(); toneWithLeading(); toneWithLeading(); |
|
72 |
|
73 function twoWithLeading(x, ...rest) |
|
74 { |
|
75 assertEq(rest.length, 2, "twoWithLeading rest wrong length"); |
|
76 } |
|
77 |
|
78 function ttwoWithLeading() |
|
79 { |
|
80 twoWithLeading(0, 1, 2); |
|
81 } |
|
82 |
|
83 ttwoWithLeading(); ttwoWithLeading(); ttwoWithLeading(); |