Build
These instruction assume you are using cygwin, but should work for linux or unix.To set up cygwin, download and install it from www.cygwin.com. Make sure the cygwin bin directory is in the windows path.
From a cygwin prompt
- cd c:/tools/CppTestTools
- make all
- AllTests/AllTests.exe -r
The first run shows some memory leaks, but we can disregard them. The are due to library routines that do not cleanup after them selves immediately (if at all).
Bonus
- NewClass.sh A shell script to create a new class (header, cpp and test file)
- cd c:/cygwin/bin
- ln -s c:/tools/CppTestTools/CppSourceTemplates/NewClass.sh NewClass
Your Project Directory
Create a directory to hold your project, for example c:Projects/eclipse/MyProjectYou will put your makefile and your source code into this directory
Your makefile
Here is a simple makefile to serve as a starting point..TARGET = TestMain LOADLIBS =\ -lUnitTestHarness\ -lGccPlatform\ -lstdc++ LIBDIRS =\ -L$(CPP_TEST_TOOLS)/lib INCLUDE = -I$(CPP_TEST_TOOLS) CPPFLAGS = $(INCLUDE) .cpp.o : gcc -c $(CPPFLAGS) -o $@ $< DOTO = test: $(TARGET) ./$(TARGET) all: $(DOTO) $(TARGET) $(TARGET): $(TARGET).o $(DOTO) $(CC) -o $(TARGET) $(LIBDIRS) $^ $(LOADLIBS) clean: rm -f *.o $(TARGET).exe
Unit test main
Create a TestMain.cpp and copy this code into it#include "UnitTestHarness/CommandLineTestRunner.h" int main(int ac, char** av) { CommandLineTestRunner::RunAllTests(ac, av); return 0; }
Build it and see that you get this result
- make test
OK (etc)