From a746d3fbfcb7c2f0a3ac047a42fdb9bf6b05ef44 Mon Sep 17 00:00:00 2001 From: Paul Zabelin Date: Fri, 19 Feb 2016 22:53:43 -0800 Subject: [PATCH] add vector projection spec --- .../project.pbxproj | 6 +++++- Example/Tests/VectorProjectionSpec.swift | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Example/Tests/VectorProjectionSpec.swift diff --git a/Example/PerspectiveTransform.xcodeproj/project.pbxproj b/Example/PerspectiveTransform.xcodeproj/project.pbxproj index dd2cbbe..94e3f9f 100644 --- a/Example/PerspectiveTransform.xcodeproj/project.pbxproj +++ b/Example/PerspectiveTransform.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 4226E76D5782BCFD7E16A726 /* Pods_PerspectiveTransform_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94A16A8706A6E84494068BCA /* Pods_PerspectiveTransform_Tests.framework */; }; 4BA3D17B1C771B2E0009B690 /* AdjugateSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA3D17A1C771B2E0009B690 /* AdjugateSpec.swift */; }; 4BA3D17D1C771B560009B690 /* SpecHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA3D17C1C771B560009B690 /* SpecHelper.swift */; }; + 4BA3D1811C77230A0009B690 /* VectorProjectionSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA3D1801C77230A0009B690 /* VectorProjectionSpec.swift */; }; 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; @@ -37,8 +38,9 @@ 4B3FE4F41C76F57000E6EB40 /* Quick.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Quick.framework; sourceTree = ""; }; 4BA3D1781C77010D0009B690 /* Gemfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Gemfile; sourceTree = ""; }; 4BA3D1791C77010D0009B690 /* Gemfile.lock */ = {isa = PBXFileReference; lastKnownFileType = text; path = Gemfile.lock; sourceTree = ""; }; - 4BA3D17A1C771B2E0009B690 /* AdjugateSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdjugateSpec.swift; sourceTree = ""; }; + 4BA3D17A1C771B2E0009B690 /* AdjugateSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = AdjugateSpec.swift; sourceTree = ""; tabWidth = 4; }; 4BA3D17C1C771B560009B690 /* SpecHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpecHelper.swift; sourceTree = ""; }; + 4BA3D1801C77230A0009B690 /* VectorProjectionSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VectorProjectionSpec.swift; sourceTree = ""; }; 4EA2244D76A3BF4D89D92FD5 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 54239BF346BDA1A204452D96 /* Pods_PerspectiveTransform_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PerspectiveTransform_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACD01AFB9204008FA782 /* PerspectiveTransform_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PerspectiveTransform_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -137,6 +139,7 @@ children = ( 607FACEB1AFB9204008FA782 /* MatrixSpec.swift */, 4BA3D17A1C771B2E0009B690 /* AdjugateSpec.swift */, + 4BA3D1801C77230A0009B690 /* VectorProjectionSpec.swift */, 607FACE91AFB9204008FA782 /* Supporting Files */, ); path = Tests; @@ -383,6 +386,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 4BA3D1811C77230A0009B690 /* VectorProjectionSpec.swift in Sources */, 607FACEC1AFB9204008FA782 /* MatrixSpec.swift in Sources */, 4BA3D17D1C771B560009B690 /* SpecHelper.swift in Sources */, 4BA3D17B1C771B2E0009B690 /* AdjugateSpec.swift in Sources */, diff --git a/Example/Tests/VectorProjectionSpec.swift b/Example/Tests/VectorProjectionSpec.swift new file mode 100644 index 0000000..d38fb81 --- /dev/null +++ b/Example/Tests/VectorProjectionSpec.swift @@ -0,0 +1,17 @@ +import Quick +import Nimble +import simd + +class VectorProjectionSpec: QuickSpec { + override func spec() { + describe("vector projection") { () -> () in + it("should be 0 orthogonally", closure: { () -> () in + let v12 = vector_float2(1,0) + let v23 = vector_float2(0,1) + let p = project(v12, v23) + expect(p.x) == 0 + expect(p.y) == 0 + }) + } + } +}