Added unit test.
This commit is contained in:
30
unittest/AttributeTest.cpp
Normal file
30
unittest/AttributeTest.cpp
Normal 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()
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user