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

# hash_test.cpp

Go to the documentation of this file.

    00001 #include <gslib/test/assert_new.h>
    00002 #define BOOST_AUTO_TEST_MAIN
    00003 #include <boost/test/auto_unit_test.hpp>
    00004 #include <gslib/static_container/list_hash.h>
    00005 #include <string.h>
    00006
    00007 using namespace gslib;
    00008 using namespace static_container;
    00009
    00011 BOOST_AUTO_UNIT_TEST( test_int_hash ) {
    00012     test::assert_new::begin(); // new 呼び出しに怒り狂う！
    00013     typedef list_hash<
    00014         int,
    00015         int,
    00016         10 >    int_hash;
    00017
    00018     int_hash ihash;
    00019     ihash[ 0 ] = 100;
    00020     ihash[ 5 ] = 20;
    00021
    00022     BOOST_REQUIRE( 2 == ihash.size() );
    00023     BOOST_REQUIRE( 100 == ihash[ 0 ] );
    00024     BOOST_REQUIRE( 20 == ihash[ 5 ] );
    00025     ihash[ 5 ] = 30;
    00026     BOOST_REQUIRE( 30 == ihash[ 5 ] );
    00027     BOOST_REQUIRE( 2 == ihash.size() );
    00028     test::assert_new::end();
    00029 }