Ben Tilly <[email protected]> writes: ... > I'm writing some C++ at the moment that fits into the first group > (performance-critical code). For unit testing I've been emitting TAP > protocol and testing it with prove, but are there better approaches? > > I get a test file with a lot of code that looks like this: > > printf( > "%s %d: Some useful description and maybe a number %d\n", > (expected_value == test_value) ? "ok" : "not ok", ++tests, > some_useful_debugging_info > ); > > I find it manageable, but I'm wondering about the next guy.
I've used Aeryn (which has disappeared from the Internet?) http://web.archive.org/web/20090322042351/http://aeryn.tigris.org/ and Boost test http://www.boost.org/doc/libs/1_38_0/libs/test/doc/html/index.html I dunno, they served their purpose, but what can you say about a unit test framework? It helps you run your code and check your values. Big deal. I don't feel like I was very much farther ahead (and in some ways behind because I deal now from outside with code that tells me (forcefully with real walls thrown up) it's private or doesn't export its interface from a dll, and I'd like to test more than the public interface sometimes though some claim that's stupid) from when I used to put #ifdefed out main functions in every file to check what's in that file completely manually. Both these frameworks were harder to get going than Test::Less and Test::More, but not dramatically so. I don't think either supports TAP output. I've heard that many people use Google's unit test framework. ACCU periodically has an article in their journals surveying test frameworks. The names of the frameworks seem to change every couple years. Writing a unit test framework maybe is like the C++ programmer equivalent of what writing an mp3 player is for gtk and qt programmers? Here's an article from 2007 that mentions the ones I mention in this email: http://accu.org/index.php/journals/1326 If you scout around more, maybe you can find newer recommendations. Probably stackoverflow would be a good place to look. If I were looking today, maybe I'd look at Cute, especially if people around me were using eclipse. Its author has an article about it here: http://accu.org/var/uploads/journals/Overload75.pdf This maybe is a better, more up to date guide to get the gist of it: http://cute-test.com/projects/cute/wiki/Writing_and_Running_CUTE_Unit_Test_Suites - Mike _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

