Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

open source regression suite [closed]

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?

like image 803
cateof Avatar asked Nov 15 '22 09:11

cateof


1 Answers

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.

like image 131
Tim Post Avatar answered Dec 29 '22 01:12

Tim Post