Ejemplo n.º 1
0
    void StripedMapHdrTest::Striped_map()
    {
        CPPUNIT_MESSAGE( "cmp") ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::compare< cmp >
            ,co::mutex_policy< cc::striped_set::striping<> >
        >   map_cmp ;
        test_striped< map_cmp >()    ;

        CPPUNIT_MESSAGE( "less") ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::less< less >
        >   map_less ;
        test_striped< map_less >()    ;

        CPPUNIT_MESSAGE( "cmpmix") ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::compare< cmp >
            , co::less< less >
        >   map_cmpmix ;
        test_striped< map_cmpmix >()    ;

        // Spinlock as lock policy
        CPPUNIT_MESSAGE( "spinlock") ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::less< less >
            ,co::mutex_policy< cc::striped_set::striping<cds::lock::Spin> >
        >   map_spin ;
        test_striped< map_spin >()    ;

        // Resizing policy
        CPPUNIT_MESSAGE( "load_factor_resizing<0>(1024)") ;
        {
            typedef cc::StripedMap< map_t
                , co::hash< hash_int >
                , co::less< less >
                , co::resizing_policy< cc::striped_set::load_factor_resizing<0> >
            >   map_less_resizing_lf ;
            map_less_resizing_lf m(30, cc::striped_set::load_factor_resizing<0>(1024)) ;
            test_striped_with(m)    ;
        }

        CPPUNIT_MESSAGE( "load_factor_resizing<256>")   ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::less< less >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
        >   map_less_resizing_lf16 ;
        test_striped< map_less_resizing_lf16 >()    ;

        CPPUNIT_MESSAGE( "single_bucket_size_threshold<0>(1024)")   ;
        {
            typedef cc::StripedMap< map_t
                , co::hash< hash_int >
                , co::compare< cmp >
                , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<0> >
            >   map_less_resizing_sbt ;
            map_less_resizing_sbt m(30, cc::striped_set::single_bucket_size_threshold<0>(1024)) ;
            test_striped_with(m)    ;
        }

        CPPUNIT_MESSAGE( "single_bucket_size_threshold<256>")   ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::less< less >
            , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<256> >
        >   map_less_resizing_sbt16 ;
        test_striped< map_less_resizing_sbt16 >()    ;

        // Copy policy
        CPPUNIT_MESSAGE( "load_factor_resizing<256>, copy_item")   ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::less< less >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
            , co::copy_policy< cc::striped_set::copy_item >
        >   set_copy_item ;
        test_striped< set_copy_item >()    ;

        CPPUNIT_MESSAGE( "load_factor_resizing<256>, swap_item")   ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::less< less >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
            , co::copy_policy< cc::striped_set::swap_item >
        >   set_swap_item ;
        test_striped< set_swap_item >()    ;

        CPPUNIT_MESSAGE( "load_factor_resizing<256>, move_item")   ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::less< less >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
            , co::copy_policy< cc::striped_set::move_item >
        >   set_move_item ;
        test_striped< set_move_item >()    ;

        CPPUNIT_MESSAGE( "load_factor_resizing<256>, special copy_policy")   ;
        typedef cc::StripedMap< map_t
            , co::hash< hash_int >
            , co::less< less >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
            , co::copy_policy< my_copy_policy >
        >   set_special_copy_item ;
        test_striped< set_special_copy_item >()    ;
    }
 void StripedMapHdrTest::Refinable_boost_map()
 {
     CPPUNIT_MESSAGE("Skipped; for Microsoft Visual C++ 2013 and boost::container::map you should use boost version 1.56 or above");
 }
    void StripedSetHdrTest::Striped_vector()
    {
        CPPUNIT_MESSAGE( "cmp");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            ,co::mutex_policy< cc::striped_set::striping<> >
        >   set_cmp;
        test_striped2< set_cmp >();

        CPPUNIT_MESSAGE( "less");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            ,co::mutex_policy< cc::striped_set::striping<> >
            , co::less< less<item> >
        >   set_less;
        test_striped2< set_less >();

        CPPUNIT_MESSAGE( "cmpmix");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            ,co::mutex_policy< cc::striped_set::striping<> >
            , co::less< less<item> >
        >   set_cmpmix;
        test_striped2< set_cmpmix >();

        // Spinlock as lock policy
        CPPUNIT_MESSAGE( "spinlock");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            , co::less< less<item> >
            , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> >
        >   set_spin;
        test_striped2< set_spin >();

        // Resizing policy
        CPPUNIT_MESSAGE( "load_factor_resizing<0>(8)");
        {
            typedef cc::StripedSet< sequence_t
                , co::hash< hash_int >
                , co::less< less<item> >
                , co::resizing_policy< cc::striped_set::load_factor_resizing<0> >
            >   set_less_resizing_lf;
            set_less_resizing_lf s( 30, cc::striped_set::load_factor_resizing<0>(8));
            test_striped_with(s);
        }

        CPPUNIT_MESSAGE( "load_factor_resizing<4>");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            , co::less< less<item> >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<4> >
        >   set_less_resizing_lf16;
        test_striped2< set_less_resizing_lf16 >();

        CPPUNIT_MESSAGE( "single_bucket_size_threshold<0>(8)");
        {
            typedef cc::StripedSet< sequence_t
                , co::hash< hash_int >
                , co::less< less<item> >
                , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<0> >
            >   set_less_resizing_sbt;
            set_less_resizing_sbt s(30, cc::striped_set::single_bucket_size_threshold<0>(8) );
            test_striped_with(s);
        }

        CPPUNIT_MESSAGE( "single_bucket_size_threshold<6>");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            , co::less< less<item> >
            , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<6> >
        >   set_less_resizing_sbt6;
        test_striped2< set_less_resizing_sbt6 >();

        // Copy policy
        CPPUNIT_MESSAGE( "copy_item");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            , co::copy_policy< cc::striped_set::copy_item >
        >   set_copy_item;
        test_striped2< set_copy_item >();

        CPPUNIT_MESSAGE( "swap_item");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            , co::copy_policy< cc::striped_set::swap_item >
        >   set_swap_item;
        test_striped2< set_swap_item >();

        CPPUNIT_MESSAGE( "move_item");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            , co::copy_policy< cc::striped_set::move_item >
        >   set_move_item;
        test_striped2< set_move_item >();

        CPPUNIT_MESSAGE( "special copy_item");
        typedef cc::StripedSet< sequence_t
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            , co::copy_policy< my_copy_policy >
        >   set_special_copy_item;
        test_striped2< set_special_copy_item >();
    }
    void StripedSetHdrTest::Refinable_boost_flat_set()
    {
        CPPUNIT_MESSAGE( "cmp");
        typedef cc::StripedSet< set_t
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            ,co::mutex_policy< cc::striped_set::refinable<> >
        >   set_cmp;
        test_striped< set_cmp >();

        CPPUNIT_MESSAGE( "less");
        typedef cc::StripedSet< set_t
            ,co::mutex_policy< cc::striped_set::refinable<> >
            , co::hash< hash_int >
            , co::less< less<item> >
        >   set_less;
        test_striped< set_less >();

        CPPUNIT_MESSAGE( "cmpmix");
        typedef cc::StripedSet< set_t
            ,co::mutex_policy< cc::striped_set::refinable<> >
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            , co::less< less<item> >
        >   set_cmpmix;
        test_striped< set_cmpmix >();

        // Spinlock as lock policy
        CPPUNIT_MESSAGE( "spinlock");
        typedef cc::StripedSet< set_t
            , co::mutex_policy< cc::striped_set::refinable<cds::sync::reentrant_spin> >
            , co::hash< hash_int >
            , co::less< less<item> >
        >   set_spin;
        test_striped< set_spin >();

        // Resizing policy
        CPPUNIT_MESSAGE( "load_factor_resizing<0>(1024)");
        {
            typedef cc::StripedSet< set_t
                ,co::mutex_policy< cc::striped_set::refinable<> >
                , co::hash< hash_int >
                , co::less< less<item> >
                , co::resizing_policy< cc::striped_set::load_factor_resizing<0> >
            >   set_less_resizing_lf;
            set_less_resizing_lf s(30, cc::striped_set::load_factor_resizing<0>(1024));
            test_striped_with(s);
        }

        CPPUNIT_MESSAGE( "load_factor_resizing<256>");
        typedef cc::StripedSet< set_t
            ,co::mutex_policy< cc::striped_set::refinable<> >
            , co::hash< hash_int >
            , co::less< less<item> >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
        >   set_less_resizing_lf16;
        test_striped< set_less_resizing_lf16 >();

        CPPUNIT_MESSAGE( "single_bucket_size_threshold<0>(1024)");
        {
            typedef cc::StripedSet< set_t
                ,co::mutex_policy< cc::striped_set::refinable<> >
                , co::hash< hash_int >
                , co::less< less<item> >
                , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<0> >
            >   set_less_resizing_sbt;
            set_less_resizing_sbt s(30, cc::striped_set::single_bucket_size_threshold<0>(1024) );
            test_striped_with(s);
        }

        CPPUNIT_MESSAGE( "single_bucket_size_threshold<256>");
        typedef cc::StripedSet< set_t
            ,co::mutex_policy< cc::striped_set::refinable<> >
            , co::hash< hash_int >
            , co::less< less<item> >
            , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<256> >
        >   set_less_resizing_sbt16;
        test_striped< set_less_resizing_sbt16 >();

        // Copy policy
        CPPUNIT_MESSAGE( "load_factor_resizing<256>, copy_item");
        typedef cc::StripedSet< set_t
            ,co::mutex_policy< cc::striped_set::refinable<> >
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
            , co::copy_policy< cc::striped_set::copy_item >
        >   set_copy_item;
        test_striped< set_copy_item >();

        CPPUNIT_MESSAGE( "load_factor_resizing<256>, swap_item");
        typedef cc::StripedSet< set_t
            ,co::mutex_policy< cc::striped_set::refinable<> >
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
            , co::copy_policy< cc::striped_set::swap_item >
        >   set_swap_item;
        test_striped< set_swap_item >();

        CPPUNIT_MESSAGE( "load_factor_resizing<256>, move_item");
        typedef cc::StripedSet< set_t
            ,co::mutex_policy< cc::striped_set::refinable<> >
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
            , co::copy_policy< cc::striped_set::move_item >
        >   set_move_item;
        test_striped< set_move_item >();

        CPPUNIT_MESSAGE( "load_factor_resizing<256>, special copy_item");
        typedef cc::StripedSet< set_t
            ,co::mutex_policy< cc::striped_set::refinable<> >
            , co::hash< hash_int >
            , co::compare< cmp<item> >
            , co::resizing_policy< cc::striped_set::load_factor_resizing<256> >
            , co::copy_policy< my_copy_policy >
        >   set_special_copy_item;
        test_striped< set_special_copy_item >();

    }
 void StripedMapHdrTest::Refinable_boost_map()
 {
     CPPUNIT_MESSAGE( "Skipped; for boost::container::map you should use boost version 1.48 or above" ) ;
 }
 void StripedSetHdrTest::Refinable_boost_flat_set()
 {
     CPPUNIT_MESSAGE( "Skipped; for boost::container::flat_set you should use boost version 1.48 or above" );
 }
 void StripedSetHdrTest::Striped_boost_stable_vector()
 {
     CPPUNIT_MESSAGE( "Skipped; for boost::container::stable_vector you should use boost version 1.48 or above" ) ;
 }
Ejemplo n.º 8
0
 void StripedMapHdrTest::Striped_boost_list()
 {
     CPPUNIT_MESSAGE( "Skipped; for boost::container::list you should use boost version 1.48 or above" ) ;
 }
Ejemplo n.º 9
0
void StripedMapHdrTest::Refinable_slist()
{
    CPPUNIT_MESSAGE( "cmp")   ;
    typedef cc::StripedMap< sequence_t
    ,co::mutex_policy< cc::striped_set::refinable<> >
    , co::hash< hash_int >
    , co::compare< cmp >
    >   map_cmp ;
    test_striped2< map_cmp >()    ;

    CPPUNIT_MESSAGE( "less")   ;
    typedef cc::StripedMap< sequence_t
    ,co::mutex_policy< cc::striped_set::refinable<> >
    , co::hash< hash_int >
    , co::less< less >
    >   map_less ;
    test_striped2< map_less >()    ;

    CPPUNIT_MESSAGE( "cmpmix")   ;
    typedef cc::StripedMap< sequence_t
    ,co::mutex_policy< cc::striped_set::refinable<> >
    , co::hash< hash_int >
    , co::compare< cmp >
    , co::less< less >
    >   map_cmpmix ;
    test_striped2< map_cmpmix >()    ;

    // Spinlock as lock policy
    CPPUNIT_MESSAGE( "spinlock")   ;
    typedef cc::StripedMap< sequence_t
    ,co::mutex_policy< cc::striped_set::refinable<cds::lock::Spin> >
    , co::hash< hash_int >
    , co::less< less >
    >   map_spin ;
    test_striped2< map_spin >()    ;

    // Resizing policy
    CPPUNIT_MESSAGE( "load_factor_resizing<0>(8)")   ;
    {
        typedef cc::StripedMap< sequence_t
        ,co::mutex_policy< cc::striped_set::refinable<> >
        , co::hash< hash_int >
        , co::less< less >
        , co::resizing_policy< cc::striped_set::load_factor_resizing<0> >
        >   pair_type_less_resizing_lf ;
        pair_type_less_resizing_lf m(30, cc::striped_set::load_factor_resizing<0>(8) ) ;
        test_striped_with(m)    ;
    }

    CPPUNIT_MESSAGE( "load_factor_resizing<4>")    ;
    typedef cc::StripedMap< sequence_t
    ,co::mutex_policy< cc::striped_set::refinable<> >
    , co::hash< hash_int >
    , co::less< less >
    , co::resizing_policy< cc::striped_set::load_factor_resizing<4> >
    >   map_less_resizing_lf16 ;
    test_striped2< map_less_resizing_lf16 >()    ;

    {
        CPPUNIT_MESSAGE( "single_bucket_size_threshold<0>(8)")    ;
        typedef cc::StripedMap< sequence_t
        ,co::mutex_policy< cc::striped_set::refinable<> >
        , co::hash< hash_int >
        , co::less< less >
        , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<0> >
        >   map_less_resizing_sbt ;
        map_less_resizing_sbt m(30, cc::striped_set::single_bucket_size_threshold<0>(8)) ;
        test_striped_with(m)    ;
    }

    CPPUNIT_MESSAGE( "single_bucket_size_threshold<6>")    ;
    typedef cc::StripedMap< sequence_t
    ,co::mutex_policy< cc::striped_set::refinable<> >
    , co::hash< hash_int >
    , co::less< less >
    , co::resizing_policy< cc::striped_set::single_bucket_size_threshold<6> >
    >   map_less_resizing_sbt16 ;
    test_striped2< map_less_resizing_sbt16 >()    ;

    // Copy policy
    CPPUNIT_MESSAGE( "copy_item")    ;
    typedef cc::StripedMap< sequence_t
    ,co::mutex_policy< cc::striped_set::refinable<> >
    , co::hash< hash_int >
    , co::less< less >
    , co::copy_policy< cc::striped_set::copy_item >
    >   set_copy_item ;
    test_striped2< set_copy_item >()    ;

    CPPUNIT_MESSAGE( "swap_item")    ;
    typedef cc::StripedMap< sequence_t
    ,co::mutex_policy< cc::striped_set::refinable<> >
    , co::hash< hash_int >
    , co::less< less >
    , co::copy_policy< cc::striped_set::swap_item >
    >   set_swap_item ;
    test_striped2< set_swap_item >()    ;

    CPPUNIT_MESSAGE( "move_item")    ;
    typedef cc::StripedMap< sequence_t
    , co::hash< hash_int >
    ,co::mutex_policy< cc::striped_set::refinable<> >
    , co::less< less >
    , co::copy_policy< cc::striped_set::move_item >
    >   set_move_item ;
    test_striped2< set_move_item >()    ;

    CPPUNIT_MESSAGE( "special copy_item")    ;
    typedef cc::StripedMap< sequence_t
    , co::hash< hash_int >
    , co::compare< cmp >
    ,co::mutex_policy< cc::striped_set::refinable<> >
    , co::copy_policy< my_copy_policy >
    >   set_special_copy_item ;
    test_striped2< set_special_copy_item >()    ;
}
void StripedMapHdrTest::Striped_slist()
{
    CPPUNIT_MESSAGE("Skipped; for Microsoft Visual C++ 2013 and boost::container::slist you should use boost version 1.56 or above");
}