#include <gslib/test/assert_new.h>
#include <boost/test/auto_unit_test.hpp>
#include <gslib/static_container/list.h>
#include "basic_sequence.h"
#include <iterator>
#include <boost/iterator/counting_iterator.hpp>
list_test.cppのインクルード依存関係図
構成 | |
struct | listgen |
struct | listgen::gen |
マクロ定義 | |
#define | BOOST_AUTO_TEST_MAIN |
関数 | |
BOOST_AUTO_UNIT_TEST (test_list_basic) | |
BOOST_AUTO_UNIT_TEST (test_lodge_list) |
|
list_test.cpp の 2 行で定義されています。 |
|
list_test.cpp の 25 行で定義されています。
00025 { 00026 test::assert_new::begin(); // new 呼び出しに怒り狂う! 00027 list_node_pool< int, 10 > pool; 00028 lodge_list< int > list0( pool ); 00029 lodge_list< int > list1( pool ); 00030 lodge_list< int > list2( pool ); 00031 00032 BOOST_REQUIRE( 10 == pool.rest() ); 00033 BOOST_REQUIRE( list0.empty() ); 00034 list0.push_back( 100 ); 00035 BOOST_REQUIRE( 1 == list0.size() ); 00036 BOOST_REQUIRE( 9 == pool.rest() ); 00037 BOOST_REQUIRE( 100 == list0.front() ); 00038 00039 list1.push_back( 10 ); 00040 list2.push_back( 5 ); 00041 list0.push_back( 9 ); 00042 BOOST_REQUIRE( 6 == pool.rest() ); 00043 list1.pop_back(); 00044 BOOST_REQUIRE( 7 == pool.rest() ); 00045 00046 // クリアされるのは、list0 のみ 00047 list0.clear(); 00048 BOOST_REQUIRE( list0.empty() ); 00049 BOOST_REQUIRE( 9 == pool.rest() ); // 他のリストが所有するノードはまだ返却されていない 00050 00051 std::copy( boost::counting_iterator< int >( 0 ), boost::counting_iterator< int >( pool.rest() ), std::back_inserter( list1 ) ); 00052 BOOST_REQUIRE( 0 == pool.rest() ); 00053 00054 BOOST_REQUIRE( list1.end() != std::find( list1.begin(), list1.end(), 5 ) ); 00055 lodge_list< int >::iterator it = list1.begin(); 00056 std::advance( it, 5 ); 00057 list1.erase( it ); 00058 BOOST_REQUIRE( list1.end() == std::find( list1.begin(), list1.end(), 5 ) ); 00059 test::assert_new::end(); 00060 } |
|
list_test.cpp の 19 行で定義されています。
00019 {
00020 test::assert_new::begin(); // new 呼び出しに怒り狂う!
00021 basic_sequence< listgen >();
00022 test::assert_new::end();
00023 }
|