Visual Studio 2005スレ Part7

このエントリーをはてなブックマークに追加
7741/2
2005EEでboostのtest_suite試したら何もしてないのにメモリリークって怒られたよ
Debugだとメモリリークが出て、Releaseだと出なかった
Debugモードは元々メモリリークしているモノなのかしら?

--- test.cpp
#include "stdafx.h"

#ifndef _DEBUG
#  pragma comment(lib, "libboost_unit_test_framework-vc80-mt-1_33_1.lib")
#else
#  pragma comment(lib, "libboost_unit_test_framework-vc80-mt-gd-1_33_1.lib")
#endif

// Boost.Test
#include <boost/test/unit_test.hpp>
using boost::unit_test::test_suite;

// most frequently you implement test cases as a free functions
void free_test_function()
{  // reports 'error in "free_test_function": test 2 == 1 failed'
  BOOST_CHECK(1 == 1); // non-critical test => continue after failure }

test_suite* init_unit_test_suite( int, char* [] ) {
  test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" );
  // this example will pass cause we know ahead of time number of expected failures
  test->add( BOOST_TEST_CASE( &free_test_function ), 1 /* expected one error */ );
  return test; }
---/test.cpp
7752/2:2006/01/12(木) 02:28:51
---output
>.\test
Running 1 test case...

*** No errors detected
Detected memory leaks!
Dumping objects ->
{177} normal block at 0x003A7CA0, 3216 bytes long.
 Data: < |: sr/dev/Inclu> E8 7C 3A 00 73 72 2F 64 65 76 2F 49 6E 63 6C 75
{153} normal block at 0x003A6EF0, 2728 bytes long.
 Data: <0o: lnD lpD wpD > 30 6F 3A 00 6C 6E 44 00 6C 70 44 00 77 70 44 00
{151} normal block at 0x003A6628, 1960 bytes long.
 Data: <Xf: D D   Xf: > 58 66 3A 00 44 E6 44 00 00 00 00 00 58 66 3A 00
{150} normal block at 0x003A6378, 640 bytes long.
 Data: < c:  D D D wpD > 98 63 3A 00 84 E5 44 00 44 E5 44 00 77 70 44 00
Object dump complete.
---/output