Skip to content

Instantly share code, notes, and snippets.

Created February 13, 2013 08:53
Show Gist options
  • Save anonymous/4943175 to your computer and use it in GitHub Desktop.
Save anonymous/4943175 to your computer and use it in GitHub Desktop.
Simple example of boost::unit_test
#include "add.hpp"
long add(long x, long y)
{
return x + y;
}
#ifndef _TEST_TEST_ADD_HPP
#define _TEST_TEST_ADD_HPP
long add(long x, long y);
#endif
#include "add.hpp"
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE( a_add_test )
{
BOOST_CHECK( add( 2, 2 ) == 4 );
}
#!/bin/sh
g++ -o add_test -I${BOOST}/include add_test.cpp add.cpp -L${BOOST}/lib/ -lboost_unit_test_framework -static
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment