From: khizmax Date: Tue, 22 Dec 2015 10:41:30 +0000 (+0300) Subject: Relaxed checking conditions for Map_InsDel_func test X-Git-Tag: v2.1.0~22 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=0d8f60e29d348a1e3ca9172376498bdd34aecc47 Relaxed checking conditions for Map_InsDel_func test --- diff --git a/tests/unit/map2/map_insdel_func.h b/tests/unit/map2/map_insdel_func.h index 3b98c578..408ac9d9 100644 --- a/tests/unit/map2/map_insdel_func.h +++ b/tests/unit/map2/map_insdel_func.h @@ -219,6 +219,9 @@ namespace map2 { void operator()( Val& cur, Val * old ) { if ( old ) { + // If a key exists, FeldmanHashMap creates a new node too + // We should manually copy important values from old to cur + std::unique_lock ac( cur.second.m_access ); cur.second.nKey = cur.first; cur.second.nData = cur.first * 8; cur.second.bInitialized.store( true, atomics::memory_order_release ); @@ -490,6 +493,7 @@ namespace map2 { << " Del fail=" << nDeleteFailed << "\n" << " : Update succ=" << (nUpdateCreated + nUpdateModified) << " fail=" << nUpdateFailed << " create=" << nUpdateCreated << " modify=" << nUpdateModified << "\n" + << " : update functor: create=" << nEnsFuncCreated << " modify=" << nEnsFuncModified << "\n" << " Map size=" << testMap.size() ); @@ -497,9 +501,7 @@ namespace map2 { CPPUNIT_CHECK_EX( nDelValueSuccess == nDeleteSuccess, "Delete success=" << nDeleteSuccess << " functor=" << nDelValueSuccess ); CPPUNIT_CHECK( nUpdateFailed == 0 ); - - CPPUNIT_CHECK_EX( nUpdateCreated == nEnsFuncCreated, "Update created=" << nUpdateCreated << " functor=" << nEnsFuncCreated ); - CPPUNIT_CHECK_EX( nUpdateModified == nEnsFuncModified, "Update modified=" << nUpdateModified << " functor=" << nEnsFuncModified ); + CPPUNIT_CHECK( nUpdateCreated + nUpdateModified == nEnsFuncCreated + nEnsFuncModified ); // nInsFuncCalled is call count of insert functor CPPUNIT_CHECK_EX( nInsFuncCalled == nInsertSuccess, "nInsertSuccess=" << nInsertSuccess << " functor nInsFuncCalled=" << nInsFuncCalled );