Sha256: 2eb4b0c68cf2669d4631a78668de6f0a67012782bf9f9632797cfdba9832dd24

Contents?: true

Size: 1.37 KB

Versions: 48

Compression:

Stored size: 1.37 KB

Contents

import XCTest
@testable import Matrix

class MatrixTests: XCTestCase {
    func testExtractARow() {
        let matrix = Matrix("1 2\n10 20")
        XCTAssertEqual([1, 2], matrix.rows[0])
    }

    func testExtractSameRowAgain() {
        let matrix = Matrix("9 7\n8 6")
        XCTAssertEqual([9, 7], matrix.rows[0])
    }

    func testExtractOtherRow() {
        let matrix = Matrix("9 8 7\n19 18 17")
        XCTAssertEqual([19, 18, 17], matrix.rows[1])
    }

    func testExtractOtherRowAgain() {
        let matrix = Matrix("1 4 9\n16 25 36")
        XCTAssertEqual([16, 25, 36], matrix.rows[1])
    }

    func testExtractAColumn() {
        let matrix = Matrix("1 2 3\n4 5 6\n7 8 9\n 8 7 6")
        XCTAssertEqual([1, 4, 7, 8], matrix.columns[0])
    }

    func testExtractAnotherColumn() {
        let matrix = Matrix("89 1903 3\n18 3 1\n9 4 800")
        XCTAssertEqual([1903, 3, 4], matrix.columns[1])
    }

    static var allTests: [(String, (MatrixTests) -> () throws -> Void)] {
        return [
            ("testExtractARow", testExtractARow),
            ("testExtractSameRowAgain", testExtractSameRowAgain),
            ("testExtractOtherRow", testExtractOtherRow),
            ("testExtractOtherRowAgain", testExtractOtherRowAgain),
            ("testExtractAColumn", testExtractAColumn),
            ("testExtractAnotherColumn", testExtractAnotherColumn),
        ]
    }
}

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
trackler-2.0.8.18 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.17 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.16 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.15 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.14 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.13 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.12 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.11 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.10 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.9 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.8 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.7 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.6 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.5 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.4 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.3 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.2 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.8.1 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.7.0 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift
trackler-2.0.6.44 tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift