Click here to Skip to main content
15,886,110 members
Articles / Programming Languages / C++

ShortCUT - A Short C++ Unit Testing Framework

Rate me:
Please Sign up or sign in to vote.
4.60/5 (9 votes)
15 Feb 2007CPOL7 min read 65.5K   948   44  
A very simple, customizable unit-testing framework for C++ developers
#include "shortcut.h"
#include "unittest.h"

int main(int argc, char* argv[])
{
#if 1
    // Creating tests manually
    TestRunner runner;
    MySuite1 mysuite1;
    MySuite1Test1 mysuite1case1;
    MySuite1Test2 mysuite1case2;
    MySuite1Test3 mysuite1case3;

    mysuite1.AddTest(&mysuite1case3);
    mysuite1.AddTest(&mysuite1case2);
    mysuite1.AddTest(&mysuite1case1);
    runner.AddSuite(&mysuite1);
    runner.RunTests();
#else
    // Creating tests the macro way
    TestRunner runner2;
    T_ADDSUITE(runner2, suite10, MySuite1);
    T_ADDTEST(suite10, 100, MySuite1Test1);
    T_ADDTEST(suite10, 101, MySuite1Test2);
    runner2.RunTests();
#endif
    
    return 0;
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United States United States
I work as a developer in the Seattle area. I am currently residing in France.

Comments and Discussions