The Wayback Machine - https://web.archive.org/web/20110718051434/http://fctx.wildbearsoftware.com/
www.wildbearsoftware.com

Overview

Fast C XUnit Test (FCTX) is a lightweight, cross platform, header-only framework for quick generation of x-unit tests in C and C++. Include a header and start typing out your tests.

With FCTX you can write tests in C/C++ just like you can in other introspective languages like Java and Python. FCTX does not require a post-processing step. FCTX does not require two-step registration of your functions. Declare your test and start writing.

Features

The list below outlines some of the current features,

  • xUnit style fixtures
  • Header only implementation
  • Filter test run through prefix match
  • Supports both C and C++ compilers
  • Supports both gcc and msvc compilers

  • Multi-File support
  • Built-in command line parser (fctcl)

  • Conditional test and test suite execution
  • Set of standard type checks for equality with helpful error reports
  • Customize and produce informative checks for your data types (fct_xchk)

  • JUnit compatible logging support

There are always plans for many more features. Send me an email to the FCTX Mailing List if you wish to see something new.

Writing a Test with FCTX

1. Download the fct.h header into your testing directory.

2. Create a new file in the testing directory, call it test.c.

3. Write your first test:

Toggle line numbers
#include "fct.h"

FCT_BGN() {
    FCT_QTEST_BGN(my_first_test) {
        fct_chk_eq_str("wild", "wild");
    } FCT_QTEST_END();
} FCT_END();

4. Compile

  • Using msvc: cl test.c

  • Using gcc: gcc test.c

5. Run

  • On windows: test.exe

  • On linux: ./a.out