From: khizmax Date: Mon, 3 Oct 2016 20:26:48 +0000 (+0300) Subject: Fixed internal statistics printing for map/set stress test X-Git-Tag: v2.2.0~101 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6553c74c16e5da0e47fb73f247feac8fa4769fa0;p=libcds.git Fixed internal statistics printing for map/set stress test --- diff --git a/projects/Win/vc14/stress-set-insdel_string.vcxproj.filters b/projects/Win/vc14/stress-set-insdel_string.vcxproj.filters index 9e1bf0ed..4d54e925 100644 --- a/projects/Win/vc14/stress-set-insdel_string.vcxproj.filters +++ b/projects/Win/vc14/stress-set-insdel_string.vcxproj.filters @@ -9,10 +9,6 @@ {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hh;hpp;hxx;hm;inl;inc;xsd - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - diff --git a/test/stress/map/insdel_string/map_insdel_string.h b/test/stress/map/insdel_string/map_insdel_string.h index 4948c4e2..41cd6a77 100644 --- a/test/stress/map/insdel_string/map_insdel_string.h +++ b/test/stress/map/insdel_string/map_insdel_string.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "map_type.h" @@ -234,8 +234,11 @@ namespace map { check_before_cleanup( testMap ); - testMap.clear(); + //testMap.clear(); + for ( auto const& str: s_arrKeys ) + testMap.erase( str ); EXPECT_TRUE( testMap.empty() ); + EXPECT_EQ( testMap.size(), 0u ); additional_check( testMap ); print_stat( propout(), testMap ); diff --git a/test/stress/map/map_type.h b/test/stress/map/map_type.h index d0d03bf1..08373a66 100644 --- a/test/stress/map/map_type.h +++ b/test/stress/map/map_type.h @@ -206,12 +206,20 @@ namespace map { return seed; } }; - }; + struct empty_stat {}; + static inline cds_test::property_stream& operator <<( cds_test::property_stream& o, empty_stat const& ) + { + return o; + } + template - static inline void print_stat( cds_test::property_stream&, Map const& /*m*/ ) - {} + static inline void print_stat( cds_test::property_stream& o, Map const& m ) + { + o << m.statistics(); + } + template static inline void check_before_cleanup( Map& /*m*/ ) diff --git a/test/stress/map/map_type_std.h b/test/stress/map/map_type_std.h index 30ce916a..f7d880c8 100644 --- a/test/stress/map/map_type_std.h +++ b/test/stress/map/map_type_std.h @@ -122,8 +122,10 @@ namespace map { return false; } - std::ostream& dump( std::ostream& stm ) { return stm; } - + empty_stat statistics() const + { + return empty_stat(); + } // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; @@ -219,7 +221,10 @@ namespace map { return false; } - std::ostream& dump( std::ostream& stm ) { return stm; } + empty_stat statistics() const + { + return empty_stat(); + } // for testing @@ -247,6 +252,7 @@ namespace map { }; } // namespace map + #define CDSSTRESS_StdMap_case( fixture, test_case, std_map_type, key_type, value_type ) \ TEST_F( fixture, std_map_type ) \ { \ diff --git a/test/stress/map/map_type_striped.h b/test/stress/map/map_type_striped.h index 44773db7..6d0d01f4 100644 --- a/test/stress/map/map_type_striped.h +++ b/test/stress/map/map_type_striped.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CDSUNIT_MAP_TYPE_STRIPED_H @@ -83,6 +83,11 @@ namespace map { : base_class( cfg.s_nMapSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor )) ) {} + empty_stat statistics() const + { + return empty_stat(); + } + // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true; @@ -111,6 +116,11 @@ namespace map { : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 )) ) {} + empty_stat statistics() const + { + return empty_stat(); + } + // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; @@ -189,6 +199,11 @@ namespace map { : base_class( cfg.s_nMapSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor ))) {} + empty_stat statistics() const + { + return empty_stat(); + } + // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true; @@ -217,6 +232,11 @@ namespace map { : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 )) ) {} + empty_stat statistics() const + { + return empty_stat(); + } + // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; diff --git a/test/stress/set/insdel_string/set_insdel_string.h b/test/stress/set/insdel_string/set_insdel_string.h index 28e75ee8..f0e11a10 100644 --- a/test/stress/set/insdel_string/set_insdel_string.h +++ b/test/stress/set/insdel_string/set_insdel_string.h @@ -385,8 +385,11 @@ namespace set { << std::make_pair( "delete_failed", nDeleteFailed ) << std::make_pair( "final_set_size", testSet.size() ); - testSet.clear(); + //testSet.clear(); + for (auto const& str: m_arrString ) + testSet.erase( str ); EXPECT_TRUE( testSet.empty() ); + EXPECT_EQ( testSet.size(), 0u ); additional_check( testSet ); print_stat( propout(), testSet ); @@ -462,8 +465,11 @@ namespace set { << std::make_pair( "extract_failed", nExtractFailed ) << std::make_pair( "final_set_size", testSet.size() ); - testSet.clear(); + //testSet.clear(); + for ( auto const& str : m_arrString ) + testSet.erase( str ); EXPECT_TRUE( testSet.empty() ); + EXPECT_EQ( testSet.size(), 0u ); additional_check( testSet ); print_stat( propout(), testSet ); diff --git a/test/stress/set/set_type.h b/test/stress/set/set_type.h index 2925cf01..cbf62c27 100644 --- a/test/stress/set/set_type.h +++ b/test/stress/set/set_type.h @@ -289,9 +289,17 @@ namespace set { // print_stat // ************************************************* + struct empty_stat {}; + static inline cds_test::property_stream& operator <<( cds_test::property_stream& o, empty_stat const& ) + { + return o; + } + template - static inline void print_stat( cds_test::property_stream&, Set const& /*s*/ ) - {} + static inline void print_stat( cds_test::property_stream& o, Set const& s ) + { + o << s.statistics(); + } //******************************************************* diff --git a/test/stress/set/set_type_std.h b/test/stress/set/set_type_std.h index 1c24f98c..68b55b48 100644 --- a/test/stress/set/set_type_std.h +++ b/test/stress/set/set_type_std.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CDSUNIT_SET_TYPE_STD_H @@ -130,7 +130,10 @@ namespace set { return false; } - std::ostream& dump( std::ostream& stm ) { return stm; } + empty_stat statistics() const + { + return empty_stat(); + } // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; @@ -215,7 +218,10 @@ namespace set { return false; } - std::ostream& dump( std::ostream& stm ) { return stm; } + empty_stat statistics() const + { + return empty_stat(); + } // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; diff --git a/test/stress/set/set_type_striped.h b/test/stress/set/set_type_striped.h index 97a39557..2da0665f 100644 --- a/test/stress/set/set_type_striped.h +++ b/test/stress/set/set_type_striped.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CDSUNIT_SET_TYPE_STRIPED_H @@ -92,6 +92,11 @@ namespace set { : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor )) ) {} + empty_stat statistics() const + { + return empty_stat(); + } + /* template bool erase_with( Q const& v, Less pred ) @@ -128,6 +133,11 @@ namespace set { : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( 1, cfg.s_nLoadFactor )) ) {} + empty_stat statistics() const + { + return empty_stat(); + } + /* template bool erase_with( Q const& v, Less pred ) @@ -165,6 +175,11 @@ namespace set { : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 )) ) {} + empty_stat statistics() const + { + return empty_stat(); + } + // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; @@ -193,6 +208,11 @@ namespace set { : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( 1024, cfg.s_nLoadFactor ))) {} + empty_stat statistics() const + { + return empty_stat(); + } + // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true; @@ -352,6 +372,11 @@ namespace set { : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor )) ) {} + empty_stat statistics() const + { + return empty_stat(); + } + /* template bool erase_with( Q const& v, Less pred ) @@ -387,6 +412,11 @@ namespace set { : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( 1, cfg.s_nLoadFactor ))) {} + empty_stat statistics() const + { + return empty_stat(); + } + // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true; @@ -415,6 +445,11 @@ namespace set { : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 )) ) {} + empty_stat statistics() const + { + return empty_stat(); + } + // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = false; @@ -442,6 +477,11 @@ namespace set { : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( 1024, cfg.s_nLoadFactor ))) {} + empty_stat statistics() const + { + return empty_stat(); + } + // for testing static CDS_CONSTEXPR bool const c_bExtractSupported = false; static CDS_CONSTEXPR bool const c_bLoadFactorDepended = true;