@@ -8,105 +8,6 @@ suite('Array', function() {
8
8
random ( mockP5 , mockP5Prototype ) ;
9
9
} ) ;
10
10
11
- suite ( 'p5.prototype.append' , function ( ) {
12
- test ( 'should be a function' , function ( ) {
13
- assert . ok ( mockP5Prototype . append ) ;
14
- assert . typeOf ( mockP5Prototype . append , 'function' ) ;
15
- } ) ;
16
-
17
- test ( 'should return an array with appended value' , function ( ) {
18
- const result = mockP5Prototype . append ( [ ] , 1 ) ;
19
- assert . typeOf ( result , 'Array' ) ;
20
- assert . deepEqual ( result , [ 1 ] ) ;
21
- } ) ;
22
- } ) ;
23
-
24
- suite ( 'p5.prototype.arrayCopy' , function ( ) {
25
- let src , dest ;
26
- beforeEach ( function ( ) {
27
- src = [ 1 , 2 , 3 , 4 , 5 ] ;
28
- dest = [ 6 , 7 , 8 ] ;
29
- } ) ;
30
-
31
- test ( 'should be a function' , function ( ) {
32
- assert . ok ( mockP5Prototype . arrayCopy ) ;
33
- assert . typeOf ( mockP5Prototype . arrayCopy , 'function' ) ;
34
- } ) ;
35
-
36
- suite ( 'src, dst' , function ( ) {
37
- test ( 'should return fully copied array' , function ( ) {
38
- mockP5Prototype . arrayCopy ( src , dest ) ;
39
- assert . deepEqual ( dest , src ) ;
40
- } ) ;
41
- } ) ;
42
-
43
- suite ( 'src, dst, len' , function ( ) {
44
- test ( 'should return an array with first 2 elements copied over' , function ( ) {
45
- mockP5Prototype . arrayCopy ( src , dest , 2 ) ;
46
- assert . deepEqual ( dest , [ 1 , 2 , 8 ] ) ;
47
- } ) ;
48
-
49
- test ( 'should return an array with first 4 elements copied over' , function ( ) {
50
- mockP5Prototype . arrayCopy ( src , dest , 4 ) ;
51
- assert . deepEqual ( dest , [ 1 , 2 , 3 , 4 ] ) ;
52
- } ) ;
53
- } ) ;
54
-
55
- suite ( 'src, srcPosition, dst, dstPosition, length' , function ( ) {
56
- // src[1 - 2] is src[1] and src[2]
57
- test ( 'should copy src[1 - 2] to dst[0 - 1]' , function ( ) {
58
- mockP5Prototype . arrayCopy ( src , 1 , dest , 0 , 2 ) ;
59
- assert . deepEqual ( dest , [ 2 , 3 , 8 ] ) ;
60
- } ) ;
61
-
62
- test ( 'should copy src[1 - 2] to dst [1 - 2]' , function ( ) {
63
- mockP5Prototype . arrayCopy ( src , 1 , dest , 1 , 2 ) ;
64
- assert . deepEqual ( dest , [ 6 , 2 , 3 ] ) ;
65
- } ) ;
66
-
67
- test ( 'should copy src[3 - 4] to dst[0 - 1]' , function ( ) {
68
- mockP5Prototype . arrayCopy ( src , 3 , dest , 0 , 2 ) ;
69
- assert . deepEqual ( dest , [ 4 , 5 , 8 ] ) ;
70
- } ) ;
71
- } ) ;
72
- } ) ;
73
-
74
- suite ( 'p5.prototype.concat' , function ( ) {
75
- test ( 'should concat empty arrays' , function ( ) {
76
- const result = mockP5Prototype . concat ( [ ] , [ ] ) ;
77
- assert . deepEqual ( result , [ ] ) ;
78
- } ) ;
79
-
80
- test ( 'should concat arrays' , function ( ) {
81
- const result = mockP5Prototype . concat ( [ 1 ] , [ 2 , 3 ] ) ;
82
- assert . deepEqual ( result , [ 1 , 2 , 3 ] ) ;
83
- } ) ;
84
- } ) ;
85
-
86
- suite ( 'p5.prototype.reverse' , function ( ) {
87
- test ( 'should reverse empty array' , function ( ) {
88
- const result = mockP5Prototype . reverse ( [ ] ) ;
89
- assert . deepEqual ( result , [ ] ) ;
90
- } ) ;
91
-
92
- test ( 'should reverse array' , function ( ) {
93
- const result = mockP5Prototype . reverse ( [ 1 , 2 , 3 ] ) ;
94
- assert . deepEqual ( result , [ 3 , 2 , 1 ] ) ;
95
- } ) ;
96
- } ) ;
97
-
98
- suite ( 'p5.prototype.shorten' , function ( ) {
99
- test ( 'should not have error for shortening empty array' , function ( ) {
100
- const result = mockP5Prototype . shorten ( [ ] ) ;
101
- assert . deepEqual ( result , [ ] ) ;
102
- } ) ;
103
-
104
- test ( 'should shorten array' , function ( ) {
105
- const result = mockP5Prototype . shorten ( [ 1 , 2 , 3 ] ) ;
106
- assert . deepEqual ( result , [ 1 , 2 ] ) ;
107
- } ) ;
108
- } ) ;
109
-
110
11
suite ( 'p5.prototype.shuffle' , function ( ) {
111
12
test ( 'should contain all the elements of the original array' , function ( ) {
112
13
let regularArr = [ 'ABC' , 'def' , { } , Math . PI * 2 , Math . E ] ;
@@ -123,50 +24,4 @@ suite('Array', function() {
123
24
assert . strictEqual ( flag , true ) ;
124
25
} ) ;
125
26
} ) ;
126
-
127
- suite ( 'p5.prototype.sort' , function ( ) {
128
- test ( 'should not have error for sorting empty array' , function ( ) {
129
- const result = mockP5Prototype . sort ( [ ] ) ;
130
- assert . deepEqual ( result , [ ] ) ;
131
- } ) ;
132
-
133
- test ( 'should sort alphabetic array lexicographically' , function ( ) {
134
- const result = mockP5Prototype . sort ( [ 'c' , 'b' , 'a' ] ) ;
135
- assert . deepEqual ( result , [ 'a' , 'b' , 'c' ] ) ;
136
- } ) ;
137
-
138
- test ( 'should sort numerical array from smallest to largest' , function ( ) {
139
- const result = mockP5Prototype . sort ( [ 2 , 1 , 11 ] ) ;
140
- assert . deepEqual ( result , [ 1 , 2 , 11 ] ) ;
141
- } ) ;
142
-
143
- test ( 'should sort numerical array from smallest to largest for only first 2 elements' , function ( ) {
144
- const result = mockP5Prototype . sort ( [ 3 , 1 , 2 , 0 ] , 2 ) ;
145
- assert . deepEqual ( result , [ 1 , 3 , 2 , 0 ] ) ;
146
- } ) ;
147
- } ) ;
148
-
149
- suite ( 'p5.prototype.splice' , function ( ) {
150
- test ( 'should insert 4 into position 1' , function ( ) {
151
- const result = mockP5Prototype . splice ( [ 1 , 2 , 3 ] , 4 , 1 ) ;
152
- assert . deepEqual ( result , [ 1 , 4 , 2 , 3 ] ) ;
153
- } ) ;
154
-
155
- test ( 'should splice in array of values' , function ( ) {
156
- const result = mockP5Prototype . splice ( [ 1 , 2 , 3 ] , [ 4 , 5 ] , 1 ) ;
157
- assert . deepEqual ( result , [ 1 , 4 , 5 , 2 , 3 ] ) ;
158
- } ) ;
159
- } ) ;
160
-
161
- suite ( 'p5.prototype.subset' , function ( ) {
162
- test ( 'should get subset from index 1 to end' , function ( ) {
163
- const result = mockP5Prototype . subset ( [ 1 , 2 , 3 ] , 1 ) ;
164
- assert . deepEqual ( result , [ 2 , 3 ] ) ;
165
- } ) ;
166
-
167
- test ( 'should subset arr[1 - 2]' , function ( ) {
168
- const result = mockP5Prototype . subset ( [ 1 , 2 , 3 , 4 ] , 1 , 2 ) ;
169
- assert . deepEqual ( result , [ 2 , 3 ] ) ;
170
- } ) ;
171
- } ) ;
172
27
} ) ;
0 commit comments