diff --git a/Tests/CLMatrix3x3Tests.m b/Tests/CLMatrix3x3Tests.m index 3a7c6e9..a034486 100644 --- a/Tests/CLMatrix3x3Tests.m +++ b/Tests/CLMatrix3x3Tests.m @@ -36,26 +36,26 @@ - (void) setUp { - (void) testZero { CLMatrix3x3 zero = CLMatrix3x3Zero(); CLMatrix3x3 test = CLMatrix3x3Multiply(a, zero); - STAssertEquals(zero, test, nil); + GHAssertEquals(zero, test, nil); } - (void) testIdentity { CLMatrix3x3 identity = CLMatrix3x3Identity(); CLMatrix3x3 test = CLMatrix3x3Multiply(a, identity); - STAssertEquals(a, test, nil); + GHAssertEquals(a, test, nil); } - (void) testDeterminant { - STAssertEquals(CLMatrix3x3Determinant(a), (double)0, nil); - STAssertEquals(CLMatrix3x3Determinant(b), (double)-418, nil); + GHAssertEquals(CLMatrix3x3Determinant(a), (double)0, nil); + GHAssertEquals(CLMatrix3x3Determinant(b), (double)-418, nil); } - (void) testTranspose { CLMatrix3x3 check = { 1, 4, 7, 2, 5, 8, 3, 6, 9 }; - STAssertEquals(CLMatrix3x3Transpose(a), check, nil); - STAssertEquals(CLMatrix3x3Transpose(check), a, nil); + GHAssertEquals(CLMatrix3x3Transpose(a), check, nil); + GHAssertEquals(CLMatrix3x3Transpose(check), a, nil); } - (void) testMultiply { @@ -65,8 +65,8 @@ - (void) testMultiply { CLMatrix3x3 checkBA = { -23, -28, -33, 79, 89, 99, 37, 35, 33 }; - STAssertEquals(CLMatrix3x3Multiply(a, b), checkAB, nil); - STAssertEquals(CLMatrix3x3Multiply(b, a), checkBA, nil); + GHAssertEquals(CLMatrix3x3Multiply(a, b), checkAB, nil); + GHAssertEquals(CLMatrix3x3Multiply(b, a), checkBA, nil); } - (void) testMultiply2 { @@ -90,9 +90,9 @@ - (void) testMultiply3 { } - (void) testTrace { - STAssertEquals(CLMatrix3x3Trace(a), (double)15, nil); - STAssertEquals(CLMatrix3x3Trace(b), (double)10, nil); - STAssertEquals(CLMatrix3x3Trace(c), (double)9, nil); + GHAssertEquals(CLMatrix3x3Trace(a), (double)15, nil); + GHAssertEquals(CLMatrix3x3Trace(b), (double)10, nil); + GHAssertEquals(CLMatrix3x3Trace(c), (double)9, nil); } - (void) testSubtract { @@ -102,22 +102,22 @@ - (void) testSubtract { - (void) testEigenvalues { double test[3], checkA[3] = {-1.116844, 0, 16.116844}, checkC[3] = {1, 2, 6}; CLMatrix3x3Eigenvalues(a, test); - STAssertEqualsWithAccuracy(test[0], checkA[0], ACCURACY, nil); - STAssertEqualsWithAccuracy(test[1], checkA[1], ACCURACY, nil); - STAssertEqualsWithAccuracy(test[2], checkA[2], ACCURACY, nil); + GHAssertEqualsWithAccuracy(test[0], checkA[0], ACCURACY, nil); + GHAssertEqualsWithAccuracy(test[1], checkA[1], ACCURACY, nil); + GHAssertEqualsWithAccuracy(test[2], checkA[2], ACCURACY, nil); CLMatrix3x3Eigenvalues(c, test); - STAssertEqualsWithAccuracy(test[0], checkC[0], ACCURACY, nil); - STAssertEqualsWithAccuracy(test[1], checkC[1], ACCURACY, nil); - STAssertEqualsWithAccuracy(test[2], checkC[2], ACCURACY, nil); + GHAssertEqualsWithAccuracy(test[0], checkC[0], ACCURACY, nil); + GHAssertEqualsWithAccuracy(test[1], checkC[1], ACCURACY, nil); + GHAssertEqualsWithAccuracy(test[2], checkC[2], ACCURACY, nil); } - (void) testEigenvaluesOneReal { double test[3], check[3] = {0, 0, 1}; CLMatrix3x3Eigenvalues(e, test); - STAssertEqualsWithAccuracy(test[0], check[0], ACCURACY, nil); - STAssertEqualsWithAccuracy(test[1], check[1], ACCURACY, nil); - STAssertEqualsWithAccuracy(test[2], check[2], ACCURACY, nil); + GHAssertEqualsWithAccuracy(test[0], check[0], ACCURACY, nil); + GHAssertEqualsWithAccuracy(test[1], check[1], ACCURACY, nil); + GHAssertEqualsWithAccuracy(test[2], check[2], ACCURACY, nil); } - (void) testEigenvectorsSymmetric{ @@ -127,18 +127,18 @@ - (void) testEigenvectorsSymmetric{ 0.128914, -0.594840, 0.793440 }; CLMatrix3x3SymmetricEigenvectors(d, testValues, testVectors); - STAssertEqualsWithAccuracy(testValues[0], checkValues[0], ACCURACY, nil); - STAssertEqualsWithAccuracy(testValues[1], checkValues[1], ACCURACY, nil); - STAssertEqualsWithAccuracy(testValues[2], checkValues[2], ACCURACY, nil); - STAssertEqualsWithAccuracy(abs(testVectors[0].x), abs(checkVectors[0].x), ACCURACY, nil); - STAssertEqualsWithAccuracy(abs(testVectors[0].y), abs(checkVectors[0].y), ACCURACY, nil); - STAssertEqualsWithAccuracy(abs(testVectors[0].z), abs(checkVectors[0].z), ACCURACY, nil); - STAssertEqualsWithAccuracy(abs(testVectors[1].x), abs(checkVectors[1].x), ACCURACY, nil); - STAssertEqualsWithAccuracy(abs(testVectors[1].y), abs(checkVectors[1].y), ACCURACY, nil); - STAssertEqualsWithAccuracy(abs(testVectors[1].z), abs(checkVectors[1].z), ACCURACY, nil); - STAssertEqualsWithAccuracy(abs(testVectors[2].x), abs(checkVectors[2].x), ACCURACY, nil); - STAssertEqualsWithAccuracy(abs(testVectors[2].y), abs(checkVectors[2].y), ACCURACY, nil); - STAssertEqualsWithAccuracy(abs(testVectors[2].z), abs(checkVectors[2].z), ACCURACY, nil); + GHAssertEqualsWithAccuracy(testValues[0], checkValues[0], ACCURACY, nil); + GHAssertEqualsWithAccuracy(testValues[1], checkValues[1], ACCURACY, nil); + GHAssertEqualsWithAccuracy(testValues[2], checkValues[2], ACCURACY, nil); + GHAssertEqualsWithAccuracy(abs(testVectors[0].x), abs(checkVectors[0].x), ACCURACY, nil); + GHAssertEqualsWithAccuracy(abs(testVectors[0].y), abs(checkVectors[0].y), ACCURACY, nil); + GHAssertEqualsWithAccuracy(abs(testVectors[0].z), abs(checkVectors[0].z), ACCURACY, nil); + GHAssertEqualsWithAccuracy(abs(testVectors[1].x), abs(checkVectors[1].x), ACCURACY, nil); + GHAssertEqualsWithAccuracy(abs(testVectors[1].y), abs(checkVectors[1].y), ACCURACY, nil); + GHAssertEqualsWithAccuracy(abs(testVectors[1].z), abs(checkVectors[1].z), ACCURACY, nil); + GHAssertEqualsWithAccuracy(abs(testVectors[2].x), abs(checkVectors[2].x), ACCURACY, nil); + GHAssertEqualsWithAccuracy(abs(testVectors[2].y), abs(checkVectors[2].y), ACCURACY, nil); + GHAssertEqualsWithAccuracy(abs(testVectors[2].z), abs(checkVectors[2].z), ACCURACY, nil); } @end diff --git a/Tests/CLTests.h b/Tests/CLTests.h index 9ad91c4..89a4bfc 100644 --- a/Tests/CLTests.h +++ b/Tests/CLTests.h @@ -1,11 +1,9 @@ -#define USE_APPLICATION_UNIT_TEST 1 - #import -#import #import +#import "GHTestCase.h" #import "CLVector.h" -@interface CLTests : SenTestCase { +@interface CLTests : GHTestCase { } diff --git a/Tests/CLTests.m b/Tests/CLTests.m index 09fc13e..cb53d30 100644 --- a/Tests/CLTests.m +++ b/Tests/CLTests.m @@ -7,10 +7,10 @@ - (void) setUp { } - (void) assertDouble:(double)a equalsDouble:(double)b withAccuracy:(double)accuracy { - /* STAssertEqualsWithAccuracy is inaccurate when either argument is not finite. */ - STAssertTrue(isfinite(a), nil); - STAssertTrue(isfinite(b), nil); - STAssertEqualsWithAccuracy(a, b, accuracy, nil); + /* GHAssertEqualsWithAccuracy is inaccurate when either argument is not finite. */ + GHAssertTrue(isfinite(a), nil); + GHAssertTrue(isfinite(b), nil); + GHAssertEqualsWithAccuracy(a, b, accuracy, nil); } - (void) assertTransform:(CATransform3D)a equalsTransform:(CATransform3D)b withAccuracy:(double)accuracy { diff --git a/Tests/CLVectorTests.h b/Tests/CLVectorTests.h index e8bea4e..4ad3ac3 100644 --- a/Tests/CLVectorTests.h +++ b/Tests/CLVectorTests.h @@ -1,9 +1,8 @@ -#import #import - +#import "GHUnit.h" #import "CLVector.h" -@interface VectorTests : SenTestCase { +@interface VectorTests : GHTestCase { CLVector a, b, c; } diff --git a/Tests/CLVectorTests.m b/Tests/CLVectorTests.m index a7ba71f..0224044 100644 --- a/Tests/CLVectorTests.m +++ b/Tests/CLVectorTests.m @@ -1,13 +1,14 @@ #import "CLVectorTests.h" +#import "GHUnit.h" #define ACCURACY 0.000000001 @implementation VectorTests - (void) assertVector:(CLVector)test equalsVector:(CLVector)check withAccuracy:(double)accuracy { - STAssertEqualsWithAccuracy(test.x, check.x, ACCURACY, nil); - STAssertEqualsWithAccuracy(test.y, check.y, ACCURACY, nil); - STAssertEqualsWithAccuracy(test.z, check.z, ACCURACY, nil); + GHAssertEqualsWithAccuracy(test.x, check.x, ACCURACY, nil); + GHAssertEqualsWithAccuracy(test.y, check.y, ACCURACY, nil); + GHAssertEqualsWithAccuracy(test.z, check.z, ACCURACY, nil); } - (void) setUp { @@ -33,7 +34,7 @@ - (void) testCross { - (void) testDot { double test = CLVectorDotProduct(a,b); double check = -1.2; - STAssertEqualsWithAccuracy(test, check, ACCURACY, nil); + GHAssertEqualsWithAccuracy(test, check, ACCURACY, nil); } - (void) testNormalize { diff --git a/iPhone.xcodeproj/project.pbxproj b/iPhone.xcodeproj/project.pbxproj index cd6bc7c..28ea8d0 100755 --- a/iPhone.xcodeproj/project.pbxproj +++ b/iPhone.xcodeproj/project.pbxproj @@ -13,7 +13,6 @@ D30E5643116D40D50068F320 /* CLQuaternion.m in Sources */ = {isa = PBXBuildFile; fileRef = D30E563D116D40D50068F320 /* CLQuaternion.m */; }; D30E5644116D40D50068F320 /* CLVector.m in Sources */ = {isa = PBXBuildFile; fileRef = D30E563F116D40D50068F320 /* CLVector.m */; }; D333CEC2116D142A00E017CE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; - D333CF4D116D15F300E017CE /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D333CF4C116D15F300E017CE /* SenTestingKit.framework */; }; D333CFA1116D166D00E017CE /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D333CFA0116D166D00E017CE /* QuartzCore.framework */; }; D36F83CA116D202600F596DE /* GHUnitIPhoneTestMain.m in Sources */ = {isa = PBXBuildFile; fileRef = D36F83BC116D202600F596DE /* GHUnitIPhoneTestMain.m */; }; D36F83CB116D202600F596DE /* libGHUnitIPhone3_0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D36F83BE116D202600F596DE /* libGHUnitIPhone3_0.a */; }; @@ -38,7 +37,6 @@ D30E563E116D40D50068F320 /* CLVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CLVector.h; path = CocoaLinear/CLVector.h; sourceTree = ""; }; D30E563F116D40D50068F320 /* CLVector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CLVector.m; path = CocoaLinear/CLVector.m; sourceTree = ""; }; D333CE76116D134C00E017CE /* Test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Test.app; sourceTree = BUILT_PRODUCTS_DIR; }; - D333CF4C116D15F300E017CE /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; }; D333CFA0116D166D00E017CE /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; D36F83AE116D1FF700F596DE /* Test-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Test-Info.plist"; sourceTree = ""; }; D36F83B2116D202600F596DE /* GHAsyncTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GHAsyncTestCase.h; sourceTree = ""; }; @@ -72,7 +70,6 @@ buildActionMask = 2147483647; files = ( D333CEC2116D142A00E017CE /* CoreGraphics.framework in Frameworks */, - D333CF4D116D15F300E017CE /* SenTestingKit.framework in Frameworks */, D333CFA1116D166D00E017CE /* QuartzCore.framework in Frameworks */, D36F83CB116D202600F596DE /* libGHUnitIPhone3_0.a in Frameworks */, ); @@ -114,7 +111,6 @@ isa = PBXGroup; children = ( D333CFA0116D166D00E017CE /* QuartzCore.framework */, - D333CF4C116D15F300E017CE /* SenTestingKit.framework */, 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 1D30AB110D05D00D00671497 /* Foundation.framework */, 288765FC0DF74451002DB57D /* CoreGraphics.framework */,