Testing C functions using OCUnit
Testing C functions using OCUnit
- Subject: Testing C functions using OCUnit
- From: Martin Redington <email@hidden>
- Date: Sun, 15 Feb 2009 18:32:50 +0000
In my projects, I tend to define methods which need access to member
variables as class methods, and related functions, which do not need
"direct" access to any internal object data, as C functions, like the
simple example below.
@implementation FunctionTestAppController
+ (id) sharedController
{
return [NSApp delegate];
}
- (BOOL) someMethod
{
// would normally access some ivar.
return YES;
}
@end
BOOL SomeFunction()
{
return YES;
}
I've recently been implementing unit testing, following
http://developer.apple.com/mac/articles/tools/unittestingwithxcode3.html
- i.e. the main app binary is specified as the bundle loader, and
testing is done via injection of the unit test bundle, with a clear
separation between application and test code.
Everything works fine for objective-C methods, but I get linker errors
when I try and reference any of the C functions defined in my
application code. nm reveals that the symbols are present in the app
binary, but the linker doesn't seem to be able to see them.
Is there a recommended, or even a good way, to get the test code to
link correctly to the applications C functions?
--
http://www.mildmanneredindustries.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden