stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ant...@apache.org
Subject svn commit: r399201 - in /incubator/stdcxx/trunk/tests/strings: 21.string.append.cpp 21.string.assign.cpp 21.string.insert.cpp 21.string.op.plus.equal.cpp 21.string.replace.cpp
Date Wed, 03 May 2006 08:32:15 GMT
Author: antonp
Date: Wed May  3 01:32:13 2006
New Revision: 399201

URL: http://svn.apache.org/viewcvs?rev=399201&view=rev
Log:
2006-05-03  Anton Pevtsov  <antonp@moscow.vdiweb.com>

	* 21.string.append.cpp (get_calls): Moved to rw_char.h
	* 21.string.assign.cpp (test_assign): Added verification
	that Traits::length() is used.
	* 21.string.insert.cpp: Same
	* 21.string.op.plus.equal.cpp: Same
	* 21.string.replace.cpp: Same

Modified:
    incubator/stdcxx/trunk/tests/strings/21.string.append.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp
    incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp

Modified: incubator/stdcxx/trunk/tests/strings/21.string.append.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.append.cpp?rev=399201&r1=399200&r2=399201&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.append.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.append.cpp Wed May  3 01:32:13 2006
@@ -392,20 +392,6 @@
 
 /**************************************************************************/
 
-template <class charT>
-std::size_t* get_calls (std::char_traits<charT>*, charT*)
-{
-    return 0;
-}
-
-template <class charT>
-std::size_t* get_calls (UserTraits<charT>*, charT*)
-{
-    return UserTraits<charT>::n_calls_;
-}
-
-/**************************************************************************/
-
 template <class charT, class Traits, class Iterator>
 void test_append_range (charT          *wstr,
                         charT          *wsrc,
@@ -527,8 +513,9 @@
 
     std::size_t total_length_calls = 0;
     std::size_t n_length_calls = 0;
-    std::size_t* rg_calls = get_calls ((typename TestString::traits_type*)0, 
-                                       (typename TestString::value_type*)0);
+    std::size_t* rg_calls = 
+        rw_get_call_counters ((typename TestString::traits_type*)0, 
+                              (typename TestString::value_type*)0);
     if (rg_calls)
         total_length_calls = rg_calls[UTMemFun::length];
 

Modified: incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp?rev=399201&r1=399200&r2=399201&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp Wed May  3 01:32:13 2006
@@ -483,6 +483,8 @@
     typedef typename TestString::iterator                StringIter;
     typedef typename TestString::const_iterator          ConstStringIter;
 
+    typedef typename UserTraits<charT>::MemFun UTMemFun;
+
     static charT wstr [LLEN];
     static charT wsrc [LLEN];
 
@@ -510,6 +512,14 @@
     const charT* const arg_ptr = tcase.arg ? wsrc : s_str.c_str ();
     const TestString&  arg_str = tcase.arg ? s_arg : s_str;
 
+    std::size_t total_length_calls = 0;
+    std::size_t n_length_calls = 0;
+    std::size_t* rg_calls = 
+        rw_get_call_counters ((typename TestString::traits_type*)0, 
+                              (typename TestString::value_type*)0);
+    if (rg_calls)
+        total_length_calls = rg_calls[UTMemFun::length];
+
 #ifndef _RWSTD_NO_REPLACEABLE_NEW_DELETE
 
     rwt_free_store* const pst = rwt_get_free_store (0);
@@ -555,6 +565,8 @@
             case Assign (ptr): {
                 const TestString& s_res = s_str.assign (arg_ptr);
                 res_off = &s_res - &s_str;
+                if (rg_calls)
+                    n_length_calls = rg_calls[UTMemFun::length];
                 break;
             }
 
@@ -615,6 +627,13 @@
                            __LINE__, int (tcase.nres), tcase.res,
                            int (sizeof (charT)), int (s_str.size ()), 
                            s_str.c_str (), match);
+            }
+
+            // verify that Traits::length was used
+            if (Assign (ptr) == which && rg_calls) {
+                rw_assert (n_length_calls - total_length_calls > 0, 
+                           0, tcase.line, "line %d. %{$FUNCALL} doesn't "
+                           "use traits::length()", __LINE__);
             }
         }
 

Modified: incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp?rev=399201&r1=399200&r2=399201&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp Wed May  3 01:32:13 2006
@@ -564,6 +564,8 @@
     typedef typename TestString::iterator                StringIter;
     typedef typename TestString::const_iterator          ConstStringIter;
 
+    typedef typename UserTraits<charT>::MemFun UTMemFun;
+
     const bool use_iters = (Insert (val) <= which);
 
     static charT wstr [LLEN];
@@ -593,6 +595,14 @@
     const TestString&  arg_str = tcase.arg ? s_arg : s_str;
     const charT        arg_val = make_char (char (tcase.val), (charT*)0);
 
+    std::size_t total_length_calls = 0;
+    std::size_t n_length_calls = 0;
+    std::size_t* rg_calls = 
+        rw_get_call_counters ((typename TestString::traits_type*)0, 
+                              (typename TestString::value_type*)0);
+    if (rg_calls)
+        total_length_calls = rg_calls[UTMemFun::length];
+
 #ifndef _RWSTD_NO_REPLACEABLE_NEW_DELETE
 
     rwt_free_store* const pst = rwt_get_free_store (0);
@@ -635,6 +645,8 @@
             case Insert (size_ptr): {
                 const TestString& s_res = s_str.insert (tcase.off, arg_ptr);
                 res_off = &s_res - &s_str;
+                if (rg_calls)
+                    n_length_calls = rg_calls[UTMemFun::length];
                 break;
             }
 
@@ -711,6 +723,13 @@
                            __LINE__, int (tcase.nres), tcase.res,
                            int (sizeof (charT)), int (s_str.size ()),
                            s_str.c_str (), match);
+            }
+
+            // verify that Traits::length was used
+            if (Insert (size_ptr) == which && rg_calls) {
+                rw_assert (n_length_calls - total_length_calls > 0, 
+                           0, tcase.line, "line %d. %{$FUNCALL} doesn't "
+                           "use traits::length()", __LINE__);
             }
         }
 

Modified: incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp?rev=399201&r1=399200&r2=399201&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp Wed May  3 01:32:13 2006
@@ -226,6 +226,8 @@
     typedef typename TestString::iterator                StringIter;
     typedef typename TestString::const_iterator          ConstStringIter;
 
+    typedef typename UserTraits<charT>::MemFun UTMemFun;
+
     static charT wstr [LLEN];
     static charT warg [LLEN];
 
@@ -246,6 +248,14 @@
     const TestString&  arg_str = tcase.arg ? s_arg : s_str;
     const charT        arg_val = make_char (char (tcase.val), (charT*)0);
 
+    std::size_t total_length_calls = 0;
+    std::size_t n_length_calls = 0;
+    std::size_t* rg_calls = 
+        rw_get_call_counters ((typename TestString::traits_type*)0, 
+                              (typename TestString::value_type*)0);
+    if (rg_calls)
+        total_length_calls = rg_calls[UTMemFun::length];
+
 #ifndef _RWSTD_NO_REPLACEABLE_NEW_DELETE
 
     rwt_free_store* const pst = rwt_get_free_store (0);
@@ -289,6 +299,8 @@
             case OpPlusEq (ptr): {
                 const TestString& s_res = s_str += arg_ptr;
                 res_off = &s_res - &s_str;
+                if (rg_calls)
+                    n_length_calls = rg_calls[UTMemFun::length];
                 break;
             }
 
@@ -335,6 +347,13 @@
                            __LINE__, int (tcase.nres), tcase.res,
                            int (sizeof (charT)), int (s_str.size ()),
                            s_str.c_str (), match);
+            }
+
+            // verify that Traits::length was used
+            if (OpPlusEq (ptr) == which && rg_calls) {
+                rw_assert (n_length_calls - total_length_calls > 0, 
+                           0, tcase.line, "line %d. %{$FUNCALL} doesn't "
+                           "use traits::length()", __LINE__);
             }
         }
 

Modified: incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp?rev=399201&r1=399200&r2=399201&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp Wed May  3 01:32:13 2006
@@ -684,6 +684,8 @@
     typedef typename TestString::iterator                StringIter;
     typedef typename TestString::const_iterator          ConstStringIter;
 
+    typedef typename UserTraits<charT>::MemFun UTMemFun;
+
     const bool use_iters = Replace (iter_iter_ptr) <= which;
 
     static charT wstr [LLEN];
@@ -722,6 +724,14 @@
     const TestString&  arg_str = tcase.arg ? s_arg : s_str;
     const charT        arg_val = make_char (char (tcase.val), (charT*)0);
 
+    std::size_t total_length_calls = 0;
+    std::size_t n_length_calls = 0;
+    std::size_t* rg_calls = 
+        rw_get_call_counters ((typename TestString::traits_type*)0, 
+                              (typename TestString::value_type*)0);
+    if (rg_calls)
+        total_length_calls = rg_calls[UTMemFun::length];
+
 #ifndef _RWSTD_NO_REPLACEABLE_NEW_DELETE
 
     rwt_free_store* const pst = rwt_get_free_store (0);
@@ -770,6 +780,8 @@
                 const TestString& s_res = 
                     s_str.replace (tcase.off, tcase.size, arg_ptr);
                 res_off = &s_res - &s_str;
+                if (rg_calls)
+                    n_length_calls = rg_calls[UTMemFun::length];
                 break;
             }
 
@@ -806,6 +818,8 @@
                 const TestString& s_res = 
                     s_str.replace (it_first, it_last, arg_ptr);
                 res_off = &s_res - &s_str;
+                if (rg_calls)
+                    n_length_calls = rg_calls[UTMemFun::length];
                 break;
             }
 
@@ -861,6 +875,16 @@
                            __LINE__, int (tcase.nres), tcase.res,
                            int (sizeof (charT)), int (s_str.size ()),
                            s_str.c_str (), match);
+            }
+
+            // verify that Traits::length was used
+            const bool verify_length_using = Replace (size_size_ptr) == which 
+                                          || Replace (iter_iter_ptr) == which;
+
+            if (verify_length_using && rg_calls) {
+                rw_assert (n_length_calls - total_length_calls > 0, 
+                           0, tcase.line, "line %d. %{$FUNCALL} doesn't "
+                           "use traits::length()", __LINE__);
             }
         }
 



Mime
View raw message