Talk About Network

Google





Mac > Mac Programmer Tools > Re: Unit Testin...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 628 of 637
Post > Topic >>

Re: Unit Testing a Library

by David Phillip Oster <oster@[EMAIL PROTECTED] > Jun 26, 2008 at 11:40 PM

In article 
<3448120c-c6fb-4475-981b-96d5e1dbd8da@[EMAIL PROTECTED]
>,
 Jason8 <jason.leach@[EMAIL PROTECTED]
> wrote:

> Hi:
> 
> I've made a C++ library and would like to develop some unit test for
> it. Do I need to make an executable to use unit tests or can I write
> them against my dylib?
> 
> Also, what does it mean in the tutorial (http://developer.apple.com/
> do***entation/DeveloperTools/Conceptual/UnitTesting/Articles/
> CreatingTests.html#//apple_ref/doc/uid/TP40002171-122120) when it says
> I need to register my tests? I suppose this depends on the answer to
> my question above.
> 
> Thanks.

You can't run tests without a program to run them. For a C++ library, 
you make a second target in the project, with a main, that links against 
your library.

If you read the link you reference above, it actually gives an example 
of registering your tests. quote:

MyTests test1(TEST_INVOCATION(MyTests, MyFirstTest));

MyTests test2(TEST_INVOCATION(MyTests, MySecondTest));

A related example, but an Objective-C library, with unit tests, is 
available at:
http://code.google.com/p/google-toolbox-for-mac
 




 3 Posts in Topic:
Unit Testing a Library
Jason8 <jason.leach@[E  2008-06-26 19:39:56 
Re: Unit Testing a Library
David Phillip Oster <o  2008-06-26 23:40:41 
Re: Unit Testing a Library
Jason8 <jason.leach@[E  2008-06-27 19:16:20 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 22:52:15 PST 2009.