Added unit test.

This commit is contained in:
Jens Luedicke
2011-01-23 23:59:43 +01:00
parent 187d265680
commit 8fe37b353f
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
#include "attribute.hpp"
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE attribute_test
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_SUITE( test_suite )
//____________________________________________________________________________//
BOOST_AUTO_TEST_CASE( test1 )
{
int x = 0;
attribute<int> a(x);
BOOST_CHECK( a.get_value() == 0 );
a.set_value("1");
BOOST_CHECK( a.get_value() == 1 );
a.set_value("0");
BOOST_CHECK( a.get_value() == 0 );
}
//____________________________________________________________________________//
BOOST_AUTO_TEST_SUITE_END()

View File

@@ -2,6 +2,10 @@ cmake_minimum_required (VERSION 2.6)
link_directories(${Boost_LIBRARY_DIRS})
add_executable(AttributeTest AttributeTest.cpp)
target_link_libraries(AttributeTest ${Boost_LIBRARIES})
add_test(AttributeTest AttributeTest)
add_executable(AttributesTest AttributesTest.cpp)
target_link_libraries(AttributesTest ${Boost_LIBRARIES})
add_test(AttributesTest AttributesTest)