|
From: Marc F. <ma...@ba...> - 2013-01-27 16:45:33
|
Hi there
I am new to unit testing (and quite new to C development too), and I'm
interested in using Cgreen as a UT framework. However when I follow the
quickstart guide, I'm facing an issue when trying to compile the second
version of the "first_test.c" example:
/* test.c */
#include "cgreen/cgreen.h"
Ensure(this_test_should_pass) {
assert_that(1 == 1, is_true);
}
Ensure(this_test_should_fail) {
assert_that(0, is_equal_to(1));
}
int
main(int argc, char **argv)
{
TestSuite *suite = create_test_suite();
add_test(suite, this_test_should_pass);
add_test(suite, this_test_should_fail);
return run_test_suite(suite, create_text_reporter());
}
$ gcc -std=gnu99 -Wall -O0 -g -lm -lcgreen -o test test.c
test.c:3:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘{’ token
test.c:7:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘{’ token
test.c: In function ‘main’:
test.c:16:5: error: ‘this_test_should_pass’ undeclared (first use in
this function)
test.c:16:5: note: each undeclared identifier is reported only once for
each function it appears in
test.c:17:5: error: ‘this_test_should_fail’ undeclared (first use in
this function)
make: *** [test2] Error 1
Am I missing something obvious?
Note: the Cgreen library is well installed and functional as the first
version of the example test works. I'm using the "1.0.0_beta2" version
with GCC 4.7.2 and Glibc 2.16.0 on GNU/Linux, let me know if you need
more information on my setup.
Regards,
m.
|