CMUT -- My C++ Unit Test Framework.


Vision

Easy to use, portable.

To avoid the generate the library. all implement in the header files.

Project home page: http://sourceforge.net/projects/cmut/

 

Rational

The only some class, such as TestCase, TestRunner, TestResult, ResultFormater.

TODO: some more detail...

 

Example

An example to demo how to use the library.

#include <cmut/testcase.hpp>
#include <cmut/testrunner.hpp>

class MyTestCase : public cm::TestCase
{
public:
    MyTestCase()
        : TestCase("MyTestCase")
    {
    }

    void run()
    {
        std::cout << "run mytestcase" << std::endl;
        CM_UT_ASSERT(0);
    }
};

class MyTest2 : public cm::TestCase
{
public:
    MyTest2()
        : TestCase("MyTest2")
    {
    }

    void run()
    {
        CM_UT_ASSERT(33==1+32);

        CM_UT_ASSERT_MESSAGE(44==2+41, "oops");
    }
};

int main()
{
    cm::TestRunner* runner = cm::TestRunner::instance();
    //runner->setResultFormater(std::auto_ptr(new cm::CompilerStyleResult()));
    runner->addTestCase(new MyTestCase);
    runner->addTestCase(new MyTest2);
    runner->run();

    return 0;
}
View the example file.

 


Thanks for
SourceForge.net Logo