C unit tester
Posted: Tue Nov 07, 2006 5:32 am
Hi.
I doubt if C coding gets a big following here, but this should at least explain why SimpleTest got a little stalled
.
I wrote a pure C (actually C99) unit tester with mocks called Cgreen. It's at...
http://www.lastcraft.com/cgreen.php
http://sourceforge.net/projects/cgreen/
It means you can now do stuff like...
Here we are testing read_paragraph() with a mock function called stub_stream().
The Cgreen unit tester has the usual bunch of assertions, expectations and reporting options. Also, if you are running more than one test (the norm), each runs in a separate process. Wouldn't want seg faults stopping the test run.
yours, Marcus
I doubt if C coding gets a big following here, but this should at least explain why SimpleTest got a little stalled
I wrote a pure C (actually C99) unit tester with mocks called Cgreen. It's at...
http://www.lastcraft.com/cgreen.php
http://sourceforge.net/projects/cgreen/
It means you can now do stuff like...
Code: Select all
static void drops_line_ending_from_word_and_stops() {
will_return(stub_stream, 't');
will_return(stub_stream, 'h');
will_return(stub_stream, 'e');
will_return(stub_stream, '\n');
assert_string_equal(read_paragraph(&stub_stream, NULL), "the");
}The Cgreen unit tester has the usual bunch of assertions, expectations and reporting options. Also, if you are running more than one test (the norm), each runs in a separate process. Wouldn't want seg faults stopping the test run.
yours, Marcus