projects
/
libcds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cb71230
)
Added tree consistency checking to the map unit test
author
khizmax
<khizmax@gmail.com>
Wed, 4 Mar 2015 15:24:27 +0000
(18:24 +0300)
committer
khizmax
<khizmax@gmail.com>
Wed, 4 Mar 2015 15:24:27 +0000
(18:24 +0300)
tests/unit/map2/map_delodd.cpp
patch
|
blob
|
history
tests/unit/map2/map_find_int.cpp
patch
|
blob
|
history
tests/unit/map2/map_find_string.cpp
patch
|
blob
|
history
tests/unit/map2/map_insdel_func.cpp
patch
|
blob
|
history
tests/unit/map2/map_insdel_int.cpp
patch
|
blob
|
history
tests/unit/map2/map_insdel_item_int.cpp
patch
|
blob
|
history
tests/unit/map2/map_insdel_item_string.cpp
patch
|
blob
|
history
tests/unit/map2/map_insdel_string.cpp
patch
|
blob
|
history
tests/unit/map2/map_insdelfind.cpp
patch
|
blob
|
history
tests/unit/map2/map_insfind_int.cpp
patch
|
blob
|
history
tests/unit/map2/map_types.h
patch
|
blob
|
history
diff --git
a/tests/unit/map2/map_delodd.cpp
b/tests/unit/map2/map_delodd.cpp
index 02332e1e8f355c1ee8238db3576f0839117e1415..a57c5d58874ccdc97e0ae8e7057dd9f6856e2e89 100644
(file)
--- a/
tests/unit/map2/map_delodd.cpp
+++ b/
tests/unit/map2/map_delodd.cpp
@@
-126,16
+126,6
@@
namespace boost {
namespace map2 {
namespace map2 {
- template <typename Map>
- static inline void check_before_clear( Map& /*s*/ )
- {}
-
- template <typename GC, typename Key, typename T, typename Traits>
- static inline void check_before_clear( cds::container::EllenBinTreeMap<GC, Key, T, Traits>& s )
- {
- CPPUNIT_CHECK_CURRENT( s.check_consistency() );
- }
-
class Map_DelOdd: public CppUnitMini::TestCase
{
std::vector<size_t> m_arrData;
class Map_DelOdd: public CppUnitMini::TestCase
{
std::vector<size_t> m_arrData;
@@
-628,7
+618,7
@@
namespace map2 {
CPPUNIT_CHECK_EX( nErrorCount == 0, "Totals: " << nErrorCount << " keys is not found");
}
CPPUNIT_CHECK_EX( nErrorCount == 0, "Totals: " << nErrorCount << " keys is not found");
}
- check_before_clea
r
( testMap );
+ check_before_clea
nup
( testMap );
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
diff --git
a/tests/unit/map2/map_find_int.cpp
b/tests/unit/map2/map_find_int.cpp
index 789fc18022d20db7e33bfe2bd469e434deaca2ea..d796e48ba303f3189246f2a0c0127e941e486647 100644
(file)
--- a/
tests/unit/map2/map_find_int.cpp
+++ b/
tests/unit/map2/map_find_int.cpp
@@
-198,6
+198,8
@@
namespace map2 {
CPPUNIT_ASSERT( pThread->m_KeyNotExists.nSuccess == (m_Arr.size() - m_nRealMapSize) * c_nPassCount );
}
CPPUNIT_ASSERT( pThread->m_KeyNotExists.nSuccess == (m_Arr.size() - m_nRealMapSize) * c_nPassCount );
}
+ check_before_cleanup( testMap );
+
testMap.clear();
additional_check( testMap );
print_stat( testMap );
testMap.clear();
additional_check( testMap );
print_stat( testMap );
diff --git
a/tests/unit/map2/map_find_string.cpp
b/tests/unit/map2/map_find_string.cpp
index d796bef664106f73d8522840d585f9398a352e91..fbdc0e48a7ed036dbed19a1959da4726f375f091 100644
(file)
--- a/
tests/unit/map2/map_find_string.cpp
+++ b/
tests/unit/map2/map_find_string.cpp
@@
-199,6
+199,8
@@
namespace map2 {
CPPUNIT_ASSERT( pThread->m_KeyNotExists.nFailed == 0 );
}
CPPUNIT_ASSERT( pThread->m_KeyNotExists.nFailed == 0 );
}
+ check_before_cleanup( testMap );
+
testMap.clear();
additional_check( testMap );
print_stat( testMap );
testMap.clear();
additional_check( testMap );
print_stat( testMap );
diff --git
a/tests/unit/map2/map_insdel_func.cpp
b/tests/unit/map2/map_insdel_func.cpp
index 2ebadc4d9aaefd1e84c7dc3624416c5c58bd24cb..65b970b79a047af76ad05d748dffc8bcd69f0f56 100644
(file)
--- a/
tests/unit/map2/map_insdel_func.cpp
+++ b/
tests/unit/map2/map_insdel_func.cpp
@@
-484,6
+484,8
@@
namespace map2 {
// nTestFunctorRef is call count of insert functor
CPPUNIT_CHECK_EX( nTestFunctorRef == nInsertSuccess, "nInsertSuccess=" << nInsertSuccess << " functor nTestFunctorRef=" << nTestFunctorRef );
// nTestFunctorRef is call count of insert functor
CPPUNIT_CHECK_EX( nTestFunctorRef == nInsertSuccess, "nInsertSuccess=" << nInsertSuccess << " functor nTestFunctorRef=" << nTestFunctorRef );
+ check_before_cleanup( testMap );
+
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) {
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
for ( size_t nItem = 0; nItem < c_nMapSize; ++nItem ) {
diff --git
a/tests/unit/map2/map_insdel_int.cpp
b/tests/unit/map2/map_insdel_int.cpp
index 57a2031d8c95d7e0502d896448e63cab610d373a..a6ecc14989d77d6e1848a620f113fd8f4ed3b459 100644
(file)
--- a/
tests/unit/map2/map_insdel_int.cpp
+++ b/
tests/unit/map2/map_insdel_int.cpp
@@
-197,6
+197,7
@@
namespace map2 {
<< " Map size=" << testMap.size()
);
<< " Map size=" << testMap.size()
);
+ check_before_cleanup( testMap );
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
diff --git
a/tests/unit/map2/map_insdel_item_int.cpp
b/tests/unit/map2/map_insdel_item_int.cpp
index deb0432f327e17fefd589f5376312800edc15238..cb4376e7ab82e4549b403fd5a9640ed6aa487387 100644
(file)
--- a/
tests/unit/map2/map_insdel_item_int.cpp
+++ b/
tests/unit/map2/map_insdel_item_int.cpp
@@
-225,6
+225,8
@@
namespace map2 {
}
CPPUNIT_MSG( " Duration=" << timer.duration() );
}
CPPUNIT_MSG( " Duration=" << timer.duration() );
+ check_before_cleanup( testMap );
+
testMap.clear();
additional_check( testMap );
print_stat( testMap );
testMap.clear();
additional_check( testMap );
print_stat( testMap );
diff --git
a/tests/unit/map2/map_insdel_item_string.cpp
b/tests/unit/map2/map_insdel_item_string.cpp
index 44ea87a265918552259f9bb567a3896762f1db67..fd062d1c3bb3a9e3b184dd493075cdf65a9cd1f6 100644
(file)
--- a/
tests/unit/map2/map_insdel_item_string.cpp
+++ b/
tests/unit/map2/map_insdel_item_string.cpp
@@
-202,6
+202,8
@@
namespace map2 {
}
CPPUNIT_MSG( " Duration=" << timer.duration() );
}
CPPUNIT_MSG( " Duration=" << timer.duration() );
+ check_before_cleanup( testMap );
+
testMap.clear();
additional_check( testMap );
print_stat( testMap );
testMap.clear();
additional_check( testMap );
print_stat( testMap );
diff --git
a/tests/unit/map2/map_insdel_string.cpp
b/tests/unit/map2/map_insdel_string.cpp
index f95b838bde4e0663a02d99eca99c9320bede26ee..a3f36f798cb8c9d437048c97e418312bbdb2a91f 100644
(file)
--- a/
tests/unit/map2/map_insdel_string.cpp
+++ b/
tests/unit/map2/map_insdel_string.cpp
@@
-195,6
+195,7
@@
namespace map2 {
<< " Map size=" << testMap.size()
);
<< " Map size=" << testMap.size()
);
+ check_before_cleanup( testMap );
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
diff --git
a/tests/unit/map2/map_insdelfind.cpp
b/tests/unit/map2/map_insdelfind.cpp
index 79bfc2fd498b6f2e38645ba145eb47b5ad7f7528..83965cb81a858605e6cfe45b702fd73cd1f069e6 100644
(file)
--- a/
tests/unit/map2/map_insdelfind.cpp
+++ b/
tests/unit/map2/map_insdelfind.cpp
@@
-175,6
+175,8
@@
namespace map2 {
);
);
+ check_before_cleanup( testMap );
+
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
testMap.clear();
CPPUNIT_MSG( " Clear map (single-threaded)..." );
timer.reset();
testMap.clear();
diff --git
a/tests/unit/map2/map_insfind_int.cpp
b/tests/unit/map2/map_insfind_int.cpp
index fc13e27f29bd4eb97faf6e3adbfbecf66874bfc9..3b279ad40842b1dcce32f2498c929db344198032 100644
(file)
--- a/
tests/unit/map2/map_insfind_int.cpp
+++ b/
tests/unit/map2/map_insfind_int.cpp
@@
-145,6
+145,8
@@
namespace map2 {
CPPUNIT_ASSERT( nInsertFailed == 0 );
CPPUNIT_ASSERT( nFindFailed == 0 );
CPPUNIT_ASSERT( nInsertFailed == 0 );
CPPUNIT_ASSERT( nFindFailed == 0 );
+ check_before_cleanup( testMap );
+
testMap.clear();
additional_check( testMap );
print_stat( testMap );
testMap.clear();
additional_check( testMap );
print_stat( testMap );
diff --git
a/tests/unit/map2/map_types.h
b/tests/unit/map2/map_types.h
index 5c1c3eb7a977bf1be4f7c47c5fc31c50b5455aae..d246c42a9dcbef7bfcab27e99fdfd61e65e5d2ce 100644
(file)
--- a/
tests/unit/map2/map_types.h
+++ b/
tests/unit/map2/map_types.h
@@
-1838,6
+1838,10
@@
namespace map2 {
static inline void print_stat( Map const& /*m*/ )
{}
static inline void print_stat( Map const& /*m*/ )
{}
+ template <typename Map>
+ static inline void check_before_cleanup( Map& /*m*/ )
+ {}
+
template <typename Map>
static inline void additional_cleanup( Map& /*m*/ )
{}
template <typename Map>
static inline void additional_cleanup( Map& /*m*/ )
{}
@@
-1908,16
+1912,25
@@
namespace map2 {
ellen_bintree_check::check_stat( s.statistics() );
}
ellen_bintree_check::check_stat( s.statistics() );
}
+ template <typename GC, typename Key, typename T, typename Traits>
+ static inline void check_before_cleanup( cc::EllenBinTreeMap<GC, Key, T, Traits>& m )
+ {
+ CPPUNIT_MSG( " Check internal consistency (single-threaded)..." );
+ CPPUNIT_CHECK_CURRENT( m.check_consistency() );
+ }
+
+
// BronsonAVLTreeMap
template <typename GC, typename Key, typename T, typename Traits>
// BronsonAVLTreeMap
template <typename GC, typename Key, typename T, typename Traits>
- static inline void print_stat( cc::BronsonAVLTreeMap<GC, Key, T, Traits> const&
s
)
+ static inline void print_stat( cc::BronsonAVLTreeMap<GC, Key, T, Traits> const&
m
)
{
{
- CPPUNIT_MSG(
s
.statistics() );
+ CPPUNIT_MSG(
m
.statistics() );
}
template <typename GC, typename Key, typename T, typename Traits>
}
template <typename GC, typename Key, typename T, typename Traits>
- static inline void
additional_check
( cc::BronsonAVLTreeMap<GC, Key, T, Traits>& m )
+ static inline void
check_before_cleanup
( cc::BronsonAVLTreeMap<GC, Key, T, Traits>& m )
{
{
+ CPPUNIT_MSG( " Check internal consistency (single-threaded)..." );
m.check_consistency([]( size_t nLevel, size_t hLeft, size_t hRight )
{
CPPUNIT_MSG( "Tree violation on level=" << nLevel << ": hLeft=" << hLeft << ", hRight=" << hRight )
m.check_consistency([]( size_t nLevel, size_t hLeft, size_t hRight )
{
CPPUNIT_MSG( "Tree violation on level=" << nLevel << ": hLeft=" << hLeft << ", hRight=" << hRight )