[Math] Some basic Vector tests
This commit is contained in:
parent
58dfb3f787
commit
23bbdac76a
4 changed files with 59 additions and 1 deletions
24
Math/MathTests/VectorTests.swift
Normal file
24
Math/MathTests/VectorTests.swift
Normal file
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// VectorTests.swift
|
||||
// Math
|
||||
//
|
||||
// Created by Eryn Wells on 11/12/15.
|
||||
// Copyright © 2015 Eryn Wells. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import Math
|
||||
|
||||
class VectorTests: XCTestCase {
|
||||
func testThatLengthOfAUnitVectorIsSane() {
|
||||
XCTAssertEqualWithAccuracy(Vector3(x: 1, y: 0, z: 0).length, 1.0, accuracy: Float.Epsilon)
|
||||
}
|
||||
|
||||
func testThatTheLength2OfAVectorIsSane() {
|
||||
XCTAssertEqualWithAccuracy(Vector3(x: 2, y: 0, z: 0).length2, 4.0, accuracy: Float.Epsilon)
|
||||
}
|
||||
|
||||
func testThatANormalizedVectorHasLength1() {
|
||||
XCTAssertEqualWithAccuracy(Vector3(x: 1, y: 2, z: 3).normalized.length, 1.0, accuracy: 1e-6)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue