| 1 |
CppUTest on Symbian |
| 2 |
|
| 3 |
Compliling |
| 4 |
|
| 5 |
To compile CppUTest you need to have Symbian Posix libraries installed. On S60 it's |
| 6 |
recommended to use S60 Open C. On other platforms one can use Symbian PIPS. Compiling is |
| 7 |
in standard way, by issuing from command line commands bldmake bldfiles && abld build in |
| 8 |
build-directory. You can also import the project's bld.inf file into Carbide in normal way. |
| 9 |
|
| 10 |
|
| 11 |
Writing tests |
| 12 |
|
| 13 |
CppUTest exports the needed header files into \epoc32\include\CppUTest -directory. Add the directory |
| 14 |
to the include-path of the test project. One needs to include TestHarness.h file into test source |
| 15 |
file. The test project must link against cpputest.lib using STATICLIBRARY statement in MMP-file. |
| 16 |
CppUTest depends also on standard C-library so the tests must be linked against libc as well. |
| 17 |
|
| 18 |
The entry point file of the tests is normally the following: |
| 19 |
#include <CppUTest/CommandLineTestRunner.h> |
| 20 |
|
| 21 |
#include <stdio.h> |
| 22 |
|
| 23 |
// This is a GCCE toolchain workaround needed when compiling with GCCE |
| 24 |
// and using main() entry point |
| 25 |
#ifdef __GCCE__ |
| 26 |
#include <staticlibinit_gcce.h> |
| 27 |
#endif |
| 28 |
|
| 29 |
int main(int argc, char** argv) |
| 30 |
{ |
| 31 |
CommandLineTestRunner::RunAllTests(argc, argv); |
| 32 |
} |
| 33 |
|
| 34 |
The test must be statically linked against libcrt0.lib if standard main (not E32Main) is used as above. |
| 35 |
|
| 36 |
For the further example, please consult alltests.mmp in build directory. |