Simple example of unit test

And without classes

#include <unittest++/UnitTest++.h>


double multiply(double x, double y) {
    return x * y;
}

TEST(MyMath) {
    CHECK_EQUAL(56, multiply(7,8));
}

int main()
{
    return UnitTest::RunAllTests();
} 

For Fortran users, the link at http://sourceforge.net/projects/fortranxunit/ contains a similar software for unit testing.