For a full list of my adventures in search of a c++ unit tester, return to the main page here. This section will focus on one candidate: EasyUnit.
Documentation: EasyUnit documention
- Downloaded easyunit-1.0-unix.tar.gz
- Entered the easyunit-src folder and typed
simplestring.cpp:85 error: bool easyunit::operator==(const easyunit::SimpleString&, const easyunit::SimpleString&) should have been declared inside easyunit
- Oh dear… well, let’s take a look at the file. Indeed, operator== is declared in the SimpleString class as a friend, but not declared independently outside of the class. Lets fix that.
- Added 2 lines to simplestring.h:
bool operator== (const SimpleString& left, const SimpleString& right);
bool operator!= (const SimpleString& left, const SimpleString& right);
makeagain… and it works!
Run An Example
From here, the online documentation is blank (losing points here…), so I get to make it up as I go along. >.<
I moved into the
examples folder, focusing on folder
1-BasicUnitTesting. We need several commands to compile this correctly:
>> mkdir easyunit >> cp ../../easyunit/* easyunit/. >> g++ -c -o stack.o stack.cpp >> g++ -c -o stactest.o stacktest.cpp >> g++ -o test stack.o stacktest.o ~/easyunit/easyunit-src/libeasyunit.a main.cpp
Okay! Now we have an executable called ‘test’ that will run the tests and produce the following output:
After playing around with more examples and making up some of my own, I feel like I have the basic grasp of the language.
- Very simple syntax
- Test framework needs little-to-no changing after initial setup
- Nice reporting format
- Very little documentation
- No obvious way to create reusable functions within tests