Void Func Test

A minimalist test framework. Each test case is essentially a free void (void), i.e. a free function with nor arguments returning nothing.

  void
  test_foo()
  {
     ...
     TEST_ASSERT("TEST PASSED");
  }

Test pass/fail is indicated by printing, to stdout/stderr/cout/cerr, and/or by throwing an exception or exiting (with a nonzero exit code).

PRO: minimalist. Few assumptions.

CON: perhaps too minimalist.


It is very minimalist, but you might be afraid of painting yourself into a corner. Consider: how easy or difficult would it be to convert these testing functions to classes? You probably already have a script that pulls out all the function names, so it is trivial to create the boilerplate class declarations. The function definition then has to be changes to seomthing like

  void test_foo::run() { ... }

Seems also within the realm of textual substitution. So perhaps changing this later on is not too expensive.


Is this like a VoigtKampffTest for programmers? If their pupils dilate when shown this code... blast 'em!


EditText of this page (last edited November 5, 2002) or FindPage with title or text search