[Math] Add test that Matrix init throws for invalid values array

This commit is contained in:
Eryn Wells 2015-11-06 08:31:56 -08:00
parent 94b12cc2ba
commit 1d1e5134d8
3 changed files with 27 additions and 2 deletions

View file

@ -8,8 +8,6 @@
import Foundation
public typealias Float = Swift.Float
/** A vector. */
public protocol Vector {
init()

View 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
}

View file

@ -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 {