[Libclc-developers] test code
Status: Planning
Brought to you by:
augestad
From: Hallvard B F. <h.b...@us...> - 2003-04-23 18:50:44
|
Some *.c files in CVS have the code #ifdef CLC_TEST int main() { test code...; } #endif This does not work if a.c requires b.c and both have this code, since we get duplicate main(). Also it means that the code must be compiled twice: Once with CLC_TEST to test it, once without to build the library. I think we instead should have a file test.c in each module directory which tests the various functions in that module. Furthermore, so that we can run the test code from 'make test', test.c should not take user input and should not require the user to read the output. Instead it should just do some hard-coded tests and do exit(EXIT_SUCCESS) without printing anything at success, and print an error message to stderr and do exit(EXIT_FAILURE) if a test fails. Or if that's too simplistic, it could take input from test.inp and write output to test.log, and 'make test' could compare test.log with a preexisting test.out. But I think that can wait until we find we actually need it. Comments? -- Hallvard |