Skip to content

Commit

Permalink
Fixed unit tests for Matrix.sum(_:axies:)
Browse files Browse the repository at this point in the history
  • Loading branch information
regexident committed Aug 29, 2019
1 parent 51f9480 commit cc1a716
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion Tests/SurgeTests/MatrixTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,23 @@ class MatrixTests: XCTestCase {
XCTAssertEqual(actual, expected, accuracy: 1e-8)
}

func test_sum_matrix_rows_double() {
typealias Scalar = Double

let lhs: Matrix<Scalar> = [
[1, 2, 3],
[4, 5, 6],
]

let actual = sum(lhs, axies: .row)
let expected: Matrix<Scalar> = [
[6],
[15],
]

XCTAssertEqual(actual, expected, accuracy: 1e-5)
}

func test_sum_matrix_rows_float() {
typealias Scalar = Float

Expand All @@ -523,7 +540,7 @@ class MatrixTests: XCTestCase {
[4, 5, 6],
]

let actual = sum(lhs, axies: .column)
let actual = sum(lhs, axies: .row)
let expected: Matrix<Scalar> = [
[6],
[15],
Expand All @@ -532,6 +549,22 @@ class MatrixTests: XCTestCase {
XCTAssertEqual(actual, expected, accuracy: 1e-5)
}

func test_sum_matrix_columns_double() {
typealias Scalar = Double

let lhs: Matrix<Scalar> = [
[1, 2, 3],
[4, 5, 6],
]

let actual = sum(lhs, axies: .column)
let expected: Matrix<Scalar> = [
[5, 7, 9],
]

XCTAssertEqual(actual, expected, accuracy: 1e-5)
}

func test_sum_matrix_columns_float() {
typealias Scalar = Float

Expand Down

0 comments on commit cc1a716

Please sign in to comment.