[squeak-dev] The Trunk: CollectionsTests-tonyg.365.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Dec 20 15:57:46 UTC 2021
Tony Garnock-Jones uploaded a new version of CollectionsTests to project The Trunk:
http://source.squeak.org/trunk/CollectionsTests-tonyg.365.mcz
==================== Summary ====================
Name: CollectionsTests-tonyg.365
Author: tonyg
Time: 20 December 2021, 4:57:38.11387 pm
UUID: 3181321c-4387-49c0-83df-2a7a849f021e
Ancestors: CollectionsTests-mt.364
Test transposition of rectangular matrices.
=============== Diff against CollectionsTests-mt.364 ===============
Item was changed:
----- Method: MatrixTest>>setUp (in category 'running') -----
setUp
matrix1 := Matrix new: 2.
matrix1 at:1 at:1 put: 1.
matrix1 at:1 at:2 put: 3.
matrix1 at:2 at:1 put: 2.
matrix1 at:2 at:2 put: 4.
matrix2 := Matrix new: 2.
matrix2 at:1 at:1 put: 3.
matrix2 at:1 at:2 put: 7.
matrix2 at:2 at:1 put: 4.
+ matrix2 at:2 at:2 put: 8.
+
+ matrix3 := Matrix rows: 3 columns: 2 tabulate: [:i :j | i * 10 + j].!
- matrix2 at:2 at:2 put: 8.!
Item was removed:
- ----- Method: MatrixTest>>testTransposed (in category 'tests - accessing') -----
- testTransposed
- | transposedMatrix |
-
- transposedMatrix := matrix1 transposed.
- self assert: [(transposedMatrix at:1 at:1) = 1].
- self assert: [(transposedMatrix at:1 at:2) = 2].
- self assert: [(transposedMatrix at:2 at:1) = 3].
- self assert: [(transposedMatrix at:2 at:2) = 4].!
Item was added:
+ ----- Method: MatrixTest>>testTransposedRectangular (in category 'tests - accessing') -----
+ testTransposedRectangular
+ | transposedMatrix |
+
+ transposedMatrix := matrix3 transposed.
+
+ self assert: [transposedMatrix rowCount = 2].
+ self assert: [transposedMatrix columnCount = 3].
+
+ self assert: [transposedMatrix = (Matrix rows: 2 columns: 3 tabulate: [:i :j | j * 10 + i])].!
Item was added:
+ ----- Method: MatrixTest>>testTransposedSquare (in category 'tests - accessing') -----
+ testTransposedSquare
+ | transposedMatrix |
+
+ transposedMatrix := matrix1 transposed.
+ self assert: [(transposedMatrix at:1 at:1) = 1].
+ self assert: [(transposedMatrix at:1 at:2) = 2].
+ self assert: [(transposedMatrix at:2 at:1) = 3].
+ self assert: [(transposedMatrix at:2 at:2) = 4].!
More information about the Squeak-dev
mailing list
|