??? Boost ?????????
???????????? ???????[ 2013/9/3 10:07:46 ] ????????
????BOOST_AUTO_TEST_SUITE ?? BOOST_AUTO_TEST_SUITE_END ????????????????????β???????????????????????????????????????Щ?????????? C++ ?????????????????? BOOST_AUTO_TEST_CASE ???????塣?嵥 3 ?????? ?嵥 2 ?д?????????
?????嵥 3. ?嵥 2 ?д???????
[arpan@tintin] ./a.out
Running 2 test cases...
test.cpp(10): error in "test1": check s.size() == 0 failed
*** 1 failure detected in test suite "stringtest"
?????????????????δ???????嵥?е???????????????????? Boost ?????????????????????BOOST_CHECK ?? BOOST_REQUIRE_EQUAL ?? Boost ????????????????????????????????????????
????Boost ???????
????Boost ???????????????????????????????????????????????????????????????? BOOST_WARN??BOOST_CHECK ?? BOOST_REQUIRE??BOOST_CHECK ?? BOOST_REQUIRE ????????????????????????????????????????????У????????????????????????????????????嵥 4 ?????????? C++ ?????????Щ??????????????
?????嵥 4. ??? Boost ????????????????
#define BOOST_TEST_MODULE enumtest
#include <boost/test/included/unit_test.hpp>
BOOST_AUTO_TEST_SUITE (enum-test)
BOOST_AUTO_TEST_CASE (test1)
{
typedef enum {red = 8?? blue?? green = 1?? yellow?? black } color;
color c = green;
BOOST_WARN(sizeof(green) > sizeof(char));
BOOST_CHECK(c == 2);
BOOST_REQUIRE(yellow > red);
BOOST_CHECK(black != 4);
}
BOOST_AUTO_TEST_SUITE_END( )
????????? BOOST_CHECK ??????????? BOOST_REQUIRE ?????????????? BOOST_REQUIRE ???????????????????????????? BOOST_CHECK???嵥 5 ????? ?嵥 4 ?д?????????
?????嵥 5. ??? BOOST_REQUIRE ?? BOOST_CHECK ???????
[arpan@tintin] ./a.out
Running 1 test case...
e2.cpp(11): error in "test1": check c == 2 failed
e2.cpp(12): fatal error in "test1": critical check yellow > red failed
*** 2 failures detected in test suite "enumtest"
????????????????????????????Щ?????????????????????????????2????????ò???????????????????????嵥 6 ????????????
?????嵥 6. ??? Boost ?????麯????????
BOOST_AUTO_TEST(functionTest1)
{
BOOST_REQUIRE(myfunc1(99?? ‘A’?? 6.2) == 12);
myClass o1(“hello world!/n”);
BOOST_REQUIRE(o1.memoryNeeded( ) < 16);
}
??????
???·???
??????????????????
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