I'm testing a c++ project. I would like multiple XCTest files to be able to use this function:
void testGLMVEC3(const glm::vec3& actual, const glm::vec3& expected)
{
XCTAssertEqualWithAccuracy(actual.x, expected.x, 0.00001f);
XCTAssertEqualWithAccuracy(actual.y, expected.y, 0.00001f);
XCTAssertEqualWithAccuracy(actual.z, expected.z, 0.00001f);
}
I'm not sure how to do this. I don't think I should put this function in my project code. I'd like it to be in my XCTest files. (I wouldn't know how to put it in my project code anyhow.) Here's how I'd expect to use it:
#import <XCTest/XCTest.h>
#import "../OrangeSpider/SpLeftLeg.hpp"
...
@interface SpLeftLegTest : XCTestCase
@end
@implementation SpLeftLegTest
- (void)setUp {}
- (void)tearDown {}
- (void)testGetPoints{
// Set up
float topLength = 10.0f;
...
// Actual SpLeftLeg
SpLeftLeg spiderLeg{spLegAnatomy, spLegAngles, minExtensionAngles, maxExtensionAngles};
// Test points
testGLMVEC3(spiderLeg.getConnectionPoint(), glm::vec3(0.0f, 0.0f, 0.0f));
}
- (void)testPerformanceExample {
[self measureBlock:^{
}];
}
@end