stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r588637 - /incubator/stdcxx/branches/4.2.x/tests/algorithms/25.remove.cpp
Date Fri, 26 Oct 2007 13:31:07 GMT
Author: faridz
Date: Fri Oct 26 06:31:06 2007
New Revision: 588637

URL: http://svn.apache.org/viewvc?rev=588637&view=rev
Log:
2007-10-26 Farid Zaripov <farid_zaripov@epam.com>

	STDCXX-619
	* 25.remove.cpp (test_remove): Move rw_assert()'s inside the
	for-loop body, to avoid invoking them when the for-loop was
	iterated 0 times).

Modified:
    incubator/stdcxx/branches/4.2.x/tests/algorithms/25.remove.cpp

Modified: incubator/stdcxx/branches/4.2.x/tests/algorithms/25.remove.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.x/tests/algorithms/25.remove.cpp?rev=588637&r1=588636&r2=588637&view=diff
==============================================================================
--- incubator/stdcxx/branches/4.2.x/tests/algorithms/25.remove.cpp (original)
+++ incubator/stdcxx/branches/4.2.x/tests/algorithms/25.remove.cpp Fri Oct 26 06:31:06 2007
@@ -188,49 +188,43 @@
 
     // verify that the value to be removed does not appear
     // anywhere in the range [first, end) : p 25.2.7.2
-    std::size_t i = 0;
-    for ( ; i != nsrc - nrem; ++i) {
+    success = true;
+    for (std::size_t i = 0; i != nsrc - nrem && success; ++i) {
         success = UChar (val) != xsrc [i].data_.val_;
-        if (!success)
-            break;
+        rw_assert (success, 0, line,
+                   "line %d: %s<%s>(\"%s\", ..., %#c) ==> "
+                   "\"%{X=*.*}\"; expected element value %#c",
+                   __LINE__, fname, itname, src, val,
+                   int (nsrc), int (i), xsrc, src [i]);
     }
 
-    rw_assert (success, 0, line,
-               "line %d: %s<%s>(\"%s\", ..., %#c) ==> "
-               "\"%{X=*.*}\"; expected element value %#c",
-               __LINE__, fname, itname, src, val,
-               int (nsrc), int (i), xsrc, src [i]);
 
     // verify that the algorithm is stable: the relative order of the elements
     // that are not removed remains unchanged : p 25.2.7.4
     success = true;
-    for (i = 1; i < nsrc - nrem; ++i) {
+    for (std::size_t i = 1; i < nsrc - nrem && success; ++i) {
         success = xsrc [i - 1].id_ < xsrc [i].id_;
-        if (!success)
-            break;
+        rw_assert (success, 0, line, 
+                   "line %d: %s<%s>(\"%s\", ..., %#c) ==> \"%{X=#*.*}\"; "
+                   "unstable at offset %zu element ids: %d and %d",
+                   __LINE__, fname, itname, src, val,
+                   int (nsrc), int (i - 1), xsrc,
+                   i - 1, xsrc [i - 1].id_, xsrc [i].id_);
     }
 
-    rw_assert (success, 0, line, 
-               "line %d: %s<%s>(\"%s\", ..., %#c) ==> \"%{X=#*.*}\"; "
-               "unstable at offset %zu element ids: %d and %d",
-               __LINE__, fname, itname, src, val,
-               int (nsrc), int (i - 1), xsrc,
-               i - 1, xsrc [i - 1].id_, xsrc [i].id_);
 
     // verify that the values of elements in the range [end, last)
     // are unchanged 
     success = true;
-    for (i = nsrc - nrem; i != nsrc; ++i) {
+    for (std::size_t i = nsrc - nrem; i != nsrc && success; ++i) {
         success = src [i] == xsrc [i].data_.val_;
-        if (!success)
-            break;
+        rw_assert (success, 0, line, 
+                   "line %d: %s<%s>(\"%s\", ..., %#c) ==> "
+                   "\"%{X=*.*}\"; expected element value %#c",
+                   __LINE__, fname, itname, src, val,
+                   int (nsrc), int (i), xsrc, val);
     }
 
-    rw_assert (success, 0, line, 
-               "line %d: %s<%s>(\"%s\", ..., %#c) ==> "
-               "\"%{X=*.*}\"; expected element value %#c",
-               __LINE__, fname, itname, src, val,
-               int (nsrc), int (i), xsrc, val);
 
     // verify the number of applications of the predicate: p 25.2.7.5
     if (tag.use_predicate) {
@@ -297,35 +291,28 @@
 
     // verify that the value to be removed does not appear anywhere
     // in the range [result, end)
-    std::size_t i = 0;
-    for ( ; i != nsrc - nrem; ++i) {
+    success = true;
+    for (std::size_t i = 0; i != nsrc - nrem && success; ++i) {
         success = UChar (val) != xdst [i].data_.val_;
-        if (!success)
-            break;
+        rw_assert (success, 0, line,
+                   "line %d: %s<%s>(\"%s\", ..., %#c) ==> "
+                   "\"%{X=*.*}\"; expected element value %#c",
+                   __LINE__, fname, itname, src, val,
+                   int (nsrc - nrem), int (i), xdst, src [i]);
     }
 
-    rw_assert (success, 0, line,
-               "line %d: %s<%s>(\"%s\", ..., %#c) ==> "
-               "\"%{X=*.*}\"; expected element value %#c",
-               __LINE__, fname, itname, src, val,
-               int (nsrc - nrem), int (i), xdst,
-               src [i]);
-
     // verify that the algorithm is stable: the relative order of the elements
     // that are not removed remains unchanged : p 25.2.7.10
     success = true;
-    for (i = 1; i < nsrc - nrem; ++i) {
+    for (std::size_t i = 1; i < nsrc - nrem && success; ++i) {
         success = xdst [i - 1].id_ < xdst [i].id_;
-        if (!success)
-            break;
+        rw_assert (success, 0, line, 
+                   "line %d: %s<%s>(\"%s\", ..., %#c) ==> \"%{X=#*.*}\"; "
+                   "unstable at offset %zu: element ids: %d and %d",
+                   __LINE__, fname, itname, src, val,
+                   int (nsrc - nrem), int (i - 1), xdst,
+                   i - 1, xdst [i - 1].id_, xdst [i].id_);
     }
-
-    rw_assert (success, 0, line, 
-               "line %d: %s<%s>(\"%s\", ..., %#c) ==> "
-               "\"%{X=#*.*}\"; unstable at offset %zu: element ids: %d and %d",
-               __LINE__, fname, itname, src, val,
-               int (nsrc - nrem), int (i - 1), xdst,
-               i - 1, xdst [i - 1].id_, xdst [i].id_);
 
     // verify the number of applications of the predicate p 25.2.7.9
     if (tag.use_predicate) {



Mime
View raw message