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