<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_multilevelhashmap.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_skip.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_split.cpp" />\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_std.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_striped.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_string_bronsonavltree.cpp" />\r
<ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_multilevelhashmap.cpp">\r
<Filter>map_insdel_int</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\..\..\tests\unit\map2\map_insdel_int_std.cpp">\r
+ <Filter>map_insdel_int</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<Filter Include="map_insdel_func">\r
tests/unit/map2/map_insdel_int_skip.cpp \
tests/unit/map2/map_insdel_int_split.cpp \
tests/unit/map2/map_insdel_int_striped.cpp \
+ tests/unit/map2/map_insdel_int_std.cpp \
tests/unit/map2/map_insdel_item_int.cpp \
tests/unit/map2/map_insdel_item_int_michael.cpp \
tests/unit/map2/map_insdel_item_int_split.cpp \
map_insdel_int_skip.cpp
map_insdel_int_split.cpp
map_insdel_int_striped.cpp
+ map_insdel_int_std.cpp
map_insdel_item_int.cpp
map_insdel_item_int_michael.cpp
map_insdel_item_int_split.cpp
//$$CDS-header$$
#define CDSUNIT_DECLARE_StdMap \
- CDSUNIT_DECLARE_TEST(StdMap_Spin) \
- CDSUNIT_DECLARE_TEST(StdHashMap_Spin)
-#define CDSUNIT_DEFINE_StdMap(IMPL, C) \
- TEST_MAP(IMPL, C, StdMap_Spin) \
- TEST_MAP(IMPL, C, StdHashMap_Spin)
+ TEST_CASE(tag_StdMap, StdMap_Spin) \
+ TEST_CASE(tag_StdMap, StdHashMap_Spin) \
+ TEST_CASE(tag_StdMap, StdMap_Mutex) \
+ TEST_CASE(tag_StdMap, StdHashMap_Mutex)
+
#define CDSUNIT_TEST_StdMap \
CPPUNIT_TEST(StdMap_Spin) \
CPPUNIT_TEST(StdHashMap_Spin) \
+ CPPUNIT_TEST(StdMap_Mutex) \
+ CPPUNIT_TEST(StdHashMap_Mutex) \
// **************************************************************************************
CDSUNIT_DECLARE_StripedMap
CDSUNIT_DECLARE_RefinableMap
CDSUNIT_DECLARE_CuckooMap
- //CDSUNIT_DECLARE_StdMap
+ CDSUNIT_DECLARE_StdMap
CPPUNIT_TEST_SUITE(Map_InsDel_int)
CDSUNIT_TEST_MichaelMap
CDSUNIT_TEST_CuckooMap
CDSUNIT_TEST_StripedMap
CDSUNIT_TEST_RefinableMap
- //CDSUNIT_TEST_StdMap
-
- //CDSUNIT_TEST_MultiLevelHashMap // the test is not suitable
+ CDSUNIT_TEST_StdMap
CPPUNIT_TEST_SUITE_END();
};
--- /dev/null
+//$$CDS-header$$
+
+#include "map2/map_insdel_int.h"
+#include "map2/map_type_std.h"
+
+#undef TEST_CASE
+#define TEST_CASE(TAG, X) void Map_InsDel_int::X() { run_test<typename map_type< TAG, key_type, value_type>::X>(); }
+#include "map2/map_defs.h"
+
+namespace map2 {
+ CDSUNIT_DECLARE_StdMap
+} // namespace map2
namespace map2 {
- struct std_implementation_tag;
+ struct tag_StdMap;
template <typename Key, typename Value>
- struct map_type< std_implementation_tag, Key, Value >: public map_type_base< Key, Value >
+ struct map_type< tag_StdMap, Key, Value >: public map_type_base< Key, Value >
{
typedef map_type_base< Key, Value > base_class;
typedef typename base_class::compare compare;
typedef typename base_class::less less;
- typedef StdMap< Key, Value, cds::sync::spin > StdMap_Spin;
- typedef StdMap< Key, Value, lock::NoLock> StdMap_NoLock;
+ typedef StdMap< Key, Value, cds::sync::spin > StdMap_Spin;
+ typedef StdMap< Key, Value, std::mutex > StdMap_Mutex;
+ typedef StdMap< Key, Value, lock::NoLock> StdMap_NoLock;
typedef StdHashMap< Key, Value, cds::sync::spin > StdHashMap_Spin;
+ typedef StdHashMap< Key, Value, std::mutex > StdHashMap_Mutex;
typedef StdHashMap< Key, Value, lock::NoLock > StdHashMap_NoLock;
};
} // namespace map2
typedef typename base_class::mapped_type value_type;
typedef size_t item_counter;
- StdHashMap( size_t /*nMapSize*/, size_t /*nLoadFactor*/ )
+ StdHashMap()
+ {}
+
+ template <class Config>
+ StdHashMap( Config const& )
{}
bool find( const Key& key )
}
template <typename T, typename Func>
- std::pair<bool, bool> ensure( const T& key, Func func )
+ std::pair<bool, bool> update( const T& key, Func func, bool /*bAllowInsert*/ = true )
{
scoped_lock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type( key, Value() ));
}
std::ostream& dump( std::ostream& stm ) { return stm; }
+
+
+ // for testing
+ static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+ static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
};
} // namespace map2
typedef typename base_class::value_type pair_type;
typedef size_t item_counter;
- StdMap( size_t /*nMapSize*/, size_t /*nLoadFactor*/ )
+ StdMap()
+ {}
+
+ template <class Config>
+ StdMap( Config const& )
{}
bool find( const Key& key )
}
template <typename T, typename Func>
- std::pair<bool, bool> ensure( const T& key, Func func )
+ std::pair<bool, bool> update( const T& key, Func func, bool /*bAllowInsert*/ = true )
{
scoped_lock al( m_lock );
std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type(key, Value() ));
}
std::ostream& dump( std::ostream& stm ) { return stm; }
+
+
+ // for testing
+ static CDS_CONSTEXPR bool const c_bExtractSupported = false;
+ static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false;
};
} // namespace map