Skip to content

Commit 2e2dded

Browse files
committed
Add more test cases for different padding types
1 parent e4f8e36 commit 2e2dded

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/Containers-Array2D-Tests/CTNewArray2DTest.class.st

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,39 @@ CTNewArray2DTest >> testFromRowsPad [
183183
self assert: (array atRow: 3) equals: #(6 0 0).
184184
]
185185

186+
{ #category : 'tests' }
187+
CTNewArray2DTest >> testFromRowsPadNoPaddingNeeded [
188+
| array |
189+
array := self arrayClass fromRows: #( #(1 2) #(3 4) ) pad: 99.
190+
191+
self assert: array width equals: 2.
192+
self assert: array height equals: 2.
193+
self assert: (array atRow: 1) equals: #(1 2).
194+
self assert: (array atRow: 2) equals: #(3 4).
195+
]
196+
197+
{ #category : 'tests' }
198+
CTNewArray2DTest >> testFromRowsPadWithCharacters [
199+
| array |
200+
array := self arrayClass fromRows: #( #($a $b) #($c) ) pad: $x.
201+
202+
self assert: array width equals: 2.
203+
self assert: array height equals: 2.
204+
self assert: (array atRow: 1) equals: #($a $b).
205+
self assert: (array atRow: 2) equals: #($c $x).
206+
]
207+
208+
{ #category : 'tests' }
209+
CTNewArray2DTest >> testFromRowsPadWithNil [
210+
| array |
211+
array := self arrayClass fromRows: #( #(1) #(2 3) ) pad: nil.
212+
213+
self assert: array width equals: 2.
214+
self assert: array height equals: 2.
215+
self assert: (array atRow: 1) equals: #(1 nil).
216+
self assert: (array atRow: 2) equals: #(2 3).
217+
]
218+
186219
{ #category : 'tests' }
187220
CTNewArray2DTest >> testFromTopToBottomFromLeftToRightDo [
188221
|foo res|

0 commit comments

Comments
 (0)