boost.test??DLL?????????????????
???????????? ???????[ 2013/8/28 17:22:19 ] ????????
????????boost??test????????????????VC??console??????????′???
#define BOOST_TEST_MODULE test_main
#include <boost/test/unit_test.hpp>
int add( int a?? int b ) {return (a+b);}
BOOST_AUTO_TEST_SUITE(minimal_test)
BOOST_AUTO_TEST_CASE( test_func_add )
{
BOOST_CHECK_EQUAL( 0?? 0 );
BOOST_CHECK_EQUAL( add(1??-1)?? 1 );
getchar();
}
BOOST_AUTO_TEST_SUITE_END()
??????????ε?console?????main?????????$(OutDir)$(ProjectName).exe?????????Post-Build Events?????????????????????
3>Performing Post-Build Event...
3>Running 2 test cases...
3>g:/test/boosttest/maintest/maintest.cpp(45): error in "test_func_add": check add(1??-1) == 1 failed [0 != 1]
3>*** 3 failures detected in test suite "test_main"
3>Project : error PRJ0019: A tool returned an error code from "Performing Post-Build Event..."
???????????????????DLL???????????????????????DLL???????????????exe??Post-Build Events??????boost.test??main???????????????????????????????????????????????????????
????1?????д?????????ó?????dll?е??????????????????????????
//dll?е????????
declspec(dllexport) void myTest()
{
CMainTest *pTest = new CMainTest();
if (*pTest>runTest())
cout<<"??????"<<endl;
delete *pTest;
}
...
//???????
test_suite* init_unit_test_suite( int?? char* [] )
{
framework::master_test_suite().p_name.value = "Unit test example 01";
// register the test case in test tree and specify number of expected failures so
// this example will pass at runtime. We expect 2 errors: one from failed check and
// one from memory acces violation
framework::master_test_suite().add( BOOST_TEST_CASE( &myTest )?? 1 );
return 0;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11