OOFILE | Downloads | Purchasing | Press | Services | Company Information | Soapbox | References | F.A.Q. | HOME 

 

Unit Testing with CodeWarrior

These pages are about how to do unit testing with CodeWarrior with cppUnit v1.8.
You can read more about cppUnit and Unit Testing at http://xprogramming.com/software.htm

To get the standard cppUnit distribution going with CodeWarrior (tested with Pro8)

  • Create a CodeWarrior SIOUX project
  • add a user level path to root cppunit directory, the one containing src
  • check the Always Search User Paths and Interpret DOS and Unix Paths boxes
  • go down to the Linker panel and turn off Dead-strip Static Initialization Code
    (so your tests will register)
  • drag in the src/cppunit folder, removing DllMain.cpp
  • To test CPPUnit itself and demonstrate it working.
    drag in examples/cppunittest folder and remove CppUnitTestMain.cpp

Download cppUnit and working CodeWarrior unit tests including string tests from http://www.oofile.com.au/downloads.html



Sample output using the text testrunner, from partway through writing
            the wide string functions
           and after all tests running on Windows (with all the test rewriting            involved because of the inconsistent 
           APIs)..........F.F...F..F
           !!!FAILURES!!!
           Test Results:
           Run: 16 Failures: 4 Errors: 01) test: WideStringTest.string_opt_3 (F)            line: 120 WideStringTest.cpp
           "! (StrCmp (foo, _T("hello")) <= 0)"

           2) test: WideStringTest.string_opt_5 (F) line: 172 WideStringTest.cpp
           "! (StrChr (bar, _T('\0')) != 0)"

           3) test: WideStringTest.string_opt_8 (F) line: 310 WideStringTest.cpp
           "! (StrCmpN (_T(""), ++s2, 1) >= 0 || s2 != s1+2)"

           4) test: WideStringTest.string_opt_10 (F) line: 472 WideStringTest.cpp
           "! (StrNCat (dst, _T("foo"), 3*CS) != dst || StrCmp (dst,            _T("hello worldfoo")))"

 

Links

back to Software Engineering Ideas