[Math] Add test that Matrix init throws for invalid values array
This commit is contained in:
parent
94b12cc2ba
commit
1d1e5134d8
3 changed files with 27 additions and 2 deletions
|
@ -8,8 +8,6 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
public typealias Float = Swift.Float
|
||||
|
||||
/** A vector. */
|
||||
public protocol Vector {
|
||||
init()
|
||||
|
|
14
Math/MathTests/MatrixFunctionalTests.swift
Normal file
14
Math/MathTests/MatrixFunctionalTests.swift
Normal file
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// MatrixFunctionalTests.swift
|
||||
// Math
|
||||
//
|
||||
// Created by Eryn Wells on 11/6/15.
|
||||
// Copyright © 2015 Eryn Wells. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
|
||||
class MatrixVectorTests: XCTestCase {
|
||||
func
|
||||
}
|
|
@ -20,6 +20,19 @@ class Matrix4Tests: XCTestCase {
|
|||
XCTAssertEqual(Matrix4.count, 16)
|
||||
XCTAssertEqual(Matrix4().data.count, Matrix4.count)
|
||||
}
|
||||
|
||||
func testThatInitThrowsForInvalidSizeOfValuesArray() {
|
||||
do {
|
||||
let m = try Matrix4(values: [])
|
||||
-m
|
||||
XCTFail()
|
||||
} catch MatrixError.InvalidSize(let given, let expected) {
|
||||
XCTAssertEqual(given, 0)
|
||||
XCTAssertEqual(expected, Matrix4.count)
|
||||
} catch {
|
||||
XCTFail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Matrix4SubscriptTests: XCTestCase {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue