[問題] Boost Unit Test problem

看板Programming作者 (我想把整片天空打開)時間18年前 (2007/06/05 07:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
我用 Boost unit test 的 unit test framework (http://www.boost.org/libs/test/doc/components/utf/index.html) 卻發現在 windows 下抓不到 access violation,因而會跳出一個錯誤視窗. 在 FreeBSD 下則沒問題,會吐出錯誤訊息: fatal error in "mytest": signal: memory access violation 在 windows 下不知道是 boost 的問題還是我的用法不對. 程式碼如下: #include <boost/test/unit_test.hpp> using namespace boost::unit_test; void mytest() { int *p = NULL; *p = 123; // access violation } test_suite* init_unit_test_suite(int argc, char* argv []) { test_suite* pSuite = BOOST_TEST_SUITE("my test"); pSuite->add(BOOST_TEST_CASE(&mytest)); return pSuite; } unit test 的參數都是預設值(log level 為 "error") http://www.boost.org/libs/test/doc/components/utf/parameters/log_level.html -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.123.19.235
文章代碼(AID): #16PGwApZ (Programming)
文章代碼(AID): #16PGwApZ (Programming)