Fixed internal statistics printing for map/set stress test
authorkhizmax <libcds.dev@gmail.com>
Mon, 3 Oct 2016 20:26:48 +0000 (23:26 +0300)
committerkhizmax <libcds.dev@gmail.com>
Mon, 3 Oct 2016 20:26:48 +0000 (23:26 +0300)
projects/Win/vc14/stress-set-insdel_string.vcxproj.filters
test/stress/map/insdel_string/map_insdel_string.h
test/stress/map/map_type.h
test/stress/map/map_type_std.h
test/stress/map/map_type_striped.h
test/stress/set/insdel_string/set_insdel_string.h
test/stress/set/set_type.h
test/stress/set/set_type_std.h
test/stress/set/set_type_striped.h

index 9e1bf0ed5c370e0f8c3d0277e7521e600a7655e4..4d54e925813f53dee77438ea8a317601867207a6 100644 (file)
@@ -9,10 +9,6 @@
       <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
       <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
     </Filter>
-    <Filter Include="Resource Files">
-      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
-    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\..\test\stress\main.cpp">
index 4948c4e2bf3083409c4556b70bd36fb98933ec7d..41cd6a7733178e6a73aae0d049efab39a32d3972 100644 (file)
@@ -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 );
index d0d03bf1523b40d152c56ec847e58930c0068eca..08373a6621ebedc1ce9d0307aa7dbf1761774eb6 100644 (file)
@@ -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 <typename Map>
-    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 <typename Map>
     static inline void check_before_cleanup( Map& /*m*/ )
index 30ce916a4aed63fd639efd0fe7c778703df69b6b..f7d880c80efcefa0f6c8b6745a52bdcd697c6fe9 100644 (file)
@@ -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 ) \
     { \
index 44773db73dbddc810e59994df22e2034ed46d0cc..6d0d01f42bfd6e95b90291a926ba516f734ae23f 100644 (file)
@@ -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;
index 28e75ee83fd52e9b8a6291ee1f3a19752dce0c19..f0e11a10262248840d55af321a79b719305e140e 100644 (file)
@@ -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 );
index 2925cf0128a4c750b34ecc680b3d1d7c2c4aa22d..cbf62c278106dd756e0632c8551566ca38c43128 100644 (file)
@@ -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 <typename Set>
-    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();
+    }
 
 
     //*******************************************************
index 1c24f98cff0f504d6d6eebf7aff3df7be0d980fa..68b55b4864e9484910afb3607739b4350a8e3d83 100644 (file)
@@ -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;
index 97a39557dade5534b3e022f5f3d903362111aefe..2da0665f18c345be56bac6f2fcb24443449af0d1 100644 (file)
@@ -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 <typename Q, typename Less>
             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 <typename Q, typename Less>
             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 <typename Q, typename Less>
             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;