Skip to content

Commit f907963

Browse files
Reducing the number of columns and rows for testing big arrays 2D
1 parent b8cc255 commit f907963

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

Array2D/array2Dtest/array2DtestTests/array2DtestTests.swift

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,26 @@ class Array2DTest: XCTestCase {
2121

2222
func testIntegerArrayWithPositiveRowsAndColumns() {
2323
let array = Array2D<Int>(columns: 3, rows: 2, initialValue: 0)
24-
XCTAssert(array.columns == 3, "Column count setup worked")
25-
XCTAssert(array.rows == 2, "Rows count setup worked")
26-
XCTAssert(array[2,2] == 0, "Integer array: Initialization value properly read")
24+
25+
XCTAssertEqual(array.columns, 3, "Column count setup failed")
26+
XCTAssertEqual(array.rows, 2, "Rows count setup failed")
27+
XCTAssertEqual(array[2,1], 0, "Integer array: Initialization value is wrong")
2728
}
2829

2930
func testStringArrayWithPositiveRowsAndColumns() {
3031
let array = Array2D<String>(columns: 3, rows: 2, initialValue: "empty")
31-
XCTAssert(array.columns == 3, "Column count setup worked")
32-
XCTAssert(array.rows == 2, "Rows count setup worked")
33-
XCTAssert(array[2,2] == "empty", "String array: Initialization value properly read")
32+
33+
XCTAssertEqual(array.columns, 3, "Column count setup failed")
34+
XCTAssertEqual(array.rows, 2, "Rows count setup failed")
35+
XCTAssertEqual(array[2,1], "empty", "String array: Initialization value is wrong")
3436
}
3537

3638
func testCustomClassArrayWithPositiveRowsAndColumns() {
3739
let array = Array2D<TestElement>(columns: 3, rows: 2, initialValue: TestElement(identifier: "pepe"))
38-
XCTAssert(array.columns == 3, "Column count setup worked")
39-
XCTAssert(array.rows == 2, "Rows count setup worked")
40-
XCTAssert(array[2,2] == TestElement(identifier: "pepe"), "Custom Class array: Initialization value properly read")
41-
}
42-
43-
func testArrayWithNegativeColumns() {
44-
let array = Array2D(columns: -1,rows: 2,initialValue: 0)
45-
XCTAssertNil(array)
46-
}
47-
48-
func testAccessingWrongIndex() {
49-
let array = Array2D(columns: 2, rows: 4, initialValue: 5)
50-
XCTAssertNil(array[20,20], "Array in 20,20 is not a valid index")
40+
41+
XCTAssertEqual(array.columns, 3, "Column count setup failed")
42+
XCTAssertEqual(array.rows, 2, "Rows count setup failed")
43+
XCTAssertEqual(array[2,1], TestElement(identifier: "pepe"), "Custom Class array: Initialization value is wrong")
5144
}
5245

5346
func testPerformanceOnSmallArray() {
@@ -58,7 +51,7 @@ class Array2DTest: XCTestCase {
5851

5952
func testPerformanceOnLargeArray() {
6053
self.measureBlock {
61-
self.printArrayWith(columns: 2000000, rows: 2000000, inititalValue: 1)
54+
self.printArrayWith(columns: 2000, rows: 2000, inititalValue: 1)
6255
}
6356
}
6457

@@ -79,7 +72,6 @@ class TestElement : Equatable {
7972
init(identifier: String) {
8073
self.identifier = identifier
8174
}
82-
8375
}
8476

8577
func == (lhs: TestElement, rhs: TestElement) -> Bool {

0 commit comments

Comments
 (0)