Click here to Skip to main content
12,503,749 members (31,230 online)
Click here to Skip to main content

Stats

42.6K views
881 downloads
44 bookmarked
Posted

ShortCUT - A Short C++ Unit Testing Framework

, 15 Feb 2007 CPOL
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)

Share

About the Author

Todd-Lucas
Web Developer
United States United States
I work as a developer in the Seattle area. I am currently residing in France.

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160919.1 | Last Updated 16 Feb 2007
Article Copyright 2007 by Todd-Lucas
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid