Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

list_test.cpp File Reference

#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>

Include dependency graph for list_test.cpp:

Include dependency graph

Go to the source code of this file.

Classes

struct  listgen
struct  listgen::gen

Defines

#define BOOST_AUTO_TEST_MAIN

Functions

 BOOST_AUTO_UNIT_TEST (test_list_basic)
 BOOST_AUTO_UNIT_TEST (test_lodge_list)


Define Documentation

#define BOOST_AUTO_TEST_MAIN
 

Definition at line 2 of file list_test.cpp.


Function Documentation

BOOST_AUTO_UNIT_TEST test_lodge_list   ) 
 

Definition at line 25 of file list_test.cpp.

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 }

BOOST_AUTO_UNIT_TEST test_list_basic   ) 
 

Definition at line 19 of file list_test.cpp.

00019                                         {
00020     test::assert_new::begin(); // new 呼び出しに怒り狂う!
00021     basic_sequence< listgen >();
00022     test::assert_new::end();
00023 }


Generated on Sat Nov 27 15:02:49 2004 for static_container by doxygen 1.3.6