I have a program, let's name it a.out, that reads input from a file and writes some output to stdout. For example a file contains the line 2,2 and my program "./a.out file" writes 4 at the screen.
Now in order to be sure that a.out works well after the patch, I am looking for a good regression suite for Linux. I want for every file that contains 2,2 my program to return 4 and I want this to be a test case.
Any ideas on regression packages?
Have a look at TAP for unit testing. Its what Perl uses for testing the innards of Perl (specifically CPAN submissions), CCAN adopted it. I'm assuming C (you did say a.out
). Then, simply make your read function fail if 2,2
is read (hinting on 3 bytes) if NDEBUG
is not defined.
You could use something else, like -DUNIT_TESTS_RUNNING
, just watch out for dependencies.
Then again, if the function you are testing returns a string .. no need to bother the preprocessor, let the test figure that out.
TAP is really, really easy to integrate. You can find my ad-hoc Valgrind aware version here. Note, that is not proper, that repo is a mess, but worth showing how easy it is to make other tools work with TAP.
Incidentally, TAP : (T)est (A)nything (P)rotocol
If this is NOT C, you need to re-tag your question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With