Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 36625 invoked from network); 20 May 2006 02:08:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 20 May 2006 02:08:17 -0000 Received: (qmail 49047 invoked by uid 500); 20 May 2006 02:08:06 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 48732 invoked by uid 500); 20 May 2006 02:08:05 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 48173 invoked by uid 99); 20 May 2006 02:08:02 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 May 2006 19:08:01 -0700 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 May 2006 19:07:56 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 74F061A9878; Fri, 19 May 2006 14:16:42 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r407913 [2/2] - in /incubator/stdcxx/trunk/tests: include/ strings/ Date: Fri, 19 May 2006 21:16:39 -0000 To: stdcxx-commits@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060519211642.74F061A9878@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/stdcxx/trunk/tests/strings/21.string.substr.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.substr.cpp?rev=407913&r1=407912&r2=407913&view=diff ============================================================================== --- incubator/stdcxx/trunk/tests/strings/21.string.substr.cpp (original) +++ incubator/stdcxx/trunk/tests/strings/21.string.substr.cpp Fri May 19 14:16:38 2006 @@ -2,7 +2,7 @@ * * 21.string.substr.cpp - string test exercising [lib.string::substr] * - * $Id$ + * $Id$ * *************************************************************************** * @@ -22,7 +22,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * **************************************************************************/ #include // for string @@ -39,10 +39,8 @@ // for convenience and brevity #define Substr(which) StringMembers::substr_ ## which -typedef StringMembers::OverloadId OverloadId; typedef StringMembers::TestCase TestCase; -typedef StringMembers::Test Test; -typedef StringMembers::Function MemFun; +typedef StringMembers::Function Function; static const char* const exceptions[] = { "unknown exception", "out_of_range", "length_error", @@ -51,9 +49,9 @@ /**************************************************************************/ -// used to exercise +// used to exercise // substr () -static const TestCase +static const TestCase void_test_cases [] = { #undef TEST @@ -63,14 +61,14 @@ // +------------------------------------- controlled sequence // | +----------------- expected result sequence - // | | - // V V - TEST ("abc", "abc"), - - TEST ("", ""), - TEST ("\0", "\0"), - TEST ("a\0", "a\0"), - TEST ("\0a", "\0a"), + // | | + // V V + TEST ("abc", "abc"), + + TEST ("", ""), + TEST ("\0", "\0"), + TEST ("a\0", "a\0"), + TEST ("\0a", "\0a"), TEST ("a\0\0bcd\0", "a\0\0bcd\0"), TEST ("\0\0abcd\0", "\0\0abcd\0"), @@ -84,9 +82,9 @@ /**************************************************************************/ -// used to exercise +// used to exercise // substr (size_type) -static const TestCase +static const TestCase size_test_cases [] = { #undef TEST @@ -98,18 +96,18 @@ // | +--------------------- substr() off argument // | | +----------------- expected result sequence // | | | +--- exception info: - // | | | | 0 - no exception - // | | | | 1 - out_of_range - // V V V V + // | | | | 0 - no exception + // | | | | 1 - out_of_range + // V V V V TEST ("abc", 0, "abc", 0), - TEST ("", 0, "", 0), - TEST ("\0", 0, "\0", 0), - TEST ("\0", 1, "", 0), - TEST ("a\0", 0, "a\0", 0), - TEST ("a\0", 1, "\0", 0), - TEST ("\0a", 0, "\0a", 0), - TEST ("\0a", 1, "a", 0), + TEST ("", 0, "", 0), + TEST ("\0", 0, "\0", 0), + TEST ("\0", 1, "", 0), + TEST ("a\0", 0, "a\0", 0), + TEST ("a\0", 1, "\0", 0), + TEST ("\0a", 0, "\0a", 0), + TEST ("\0a", 1, "a", 0), TEST ("a\0\0bcd\0", 0, "a\0\0bcd\0", 0), TEST ("a\0\0bcd\0", 1, "\0\0bcd\0", 0), @@ -139,9 +137,9 @@ /**************************************************************************/ -// used to exercise +// used to exercise // substr (size_type, size_type) -static const TestCase +static const TestCase size_size_test_cases [] = { #undef TEST @@ -154,23 +152,23 @@ // | | +-------------------- substr() n argument // | | | +----------------- expected result sequence // | | | | +--- exception info: - // | | | | | 0 - no exception - // | | | | | 1 - out_of_range - // V V V V V + // | | | | | 0 - no exception + // | | | | | 1 - out_of_range + // V V V V V TEST ("abc", 0, 3, "abc", 0), - TEST ("", 0, 0, "", 0), - TEST ("\0", 0, 1, "\0", 0), + TEST ("", 0, 0, "", 0), + TEST ("\0", 0, 1, "\0", 0), TEST ("\0", 0, 0, "", 0), - TEST ("\0", 1, 1, "", 0), - TEST ("a\0", 0, 2, "a\0", 0), - TEST ("a\0", 1, 2, "\0", 0), - TEST ("a\0", 0, 1, "a", 0), - TEST ("a\0", 1, 1, "\0", 0), - TEST ("a\0", 1, 0, "", 0), - TEST ("\0a", 0, 2, "\0a", 0), + TEST ("\0", 1, 1, "", 0), + TEST ("a\0", 0, 2, "a\0", 0), + TEST ("a\0", 1, 2, "\0", 0), + TEST ("a\0", 0, 1, "a", 0), + TEST ("a\0", 1, 1, "\0", 0), + TEST ("a\0", 1, 0, "", 0), + TEST ("\0a", 0, 2, "\0a", 0), TEST ("\0a", 0, 1, "\0", 0), - TEST ("\0a", 1, 2, "a", 0), + TEST ("\0a", 1, 2, "a", 0), TEST ("a\0\0bcd\0", 0, 7, "a\0\0bcd\0", 0), TEST ("a\0\0bcd\0", 1, 7, "\0\0bcd\0", 0), @@ -212,8 +210,8 @@ template void test_substr (charT, Traits*, Allocator*, - OverloadId which, - const TestCase &cs) + const Function &func, + const TestCase &tcase) { typedef std::basic_string String; @@ -221,21 +219,20 @@ static charT wstr_buf [BUFSIZE]; std::size_t str_len = sizeof wstr_buf / sizeof *wstr_buf; - charT* wstr = rw_expand (wstr_buf, cs.str, cs.str_len, &str_len); + charT* wstr = rw_expand (wstr_buf, tcase.str, tcase.str_len, &str_len); static charT wres_buf [BUFSIZE]; std::size_t res_len = sizeof wres_buf / sizeof *wres_buf; - charT* wres = rw_expand (wres_buf, cs.res, cs.nres, &res_len); + charT* wres = rw_expand (wres_buf, tcase.res, tcase.nres, &res_len); - // construct the string object - const String str (wstr, str_len); + // construct the string object + const String str (wstr, str_len); if (wstr != wstr_buf) delete[] wstr; wstr = 0; - String s_res; // save the state of the string object before the call @@ -246,12 +243,12 @@ #ifndef _RWSTD_NO_EXCEPTIONS // is some exception expected? - const char* const expected = cs.bthrow ? exceptions [1] : 0; + const char* const expected = tcase.bthrow ? exceptions [1] : 0; const char* caught = 0; #else - if (cs.bthrow) { + if (tcase.bthrow) { if (wres != wres_buf) delete[] wres; @@ -261,17 +258,17 @@ #endif // _RWSTD_NO_EXCEPTIONS try { - switch (which) { + switch (func.which_) { case Substr (void): s_res = str.substr (); break; case Substr (size): - s_res = str.substr (cs.off); + s_res = str.substr (tcase.off); break; case Substr (size_size): - s_res = str.substr (cs.off, cs.size); + s_res = str.substr (tcase.off, tcase.size); break; default: @@ -280,11 +277,11 @@ } // verfiy that strings length are equal - rw_assert (res_len == s_res.size (), 0, cs.line, + rw_assert (res_len == s_res.size (), 0, tcase.line, "line %d. %{$FUNCALL} expected %{#*s} with length " "%zu, got %{/*.*Gs} with length %zu", - __LINE__, int (cs.nres), cs.res, - res_len, int (sizeof (charT)), + __LINE__, int (tcase.nres), tcase.res, + res_len, int (sizeof (charT)), int (s_res.size ()), s_res.c_str (), s_res.size ()); if (res_len == s_res.size ()) { @@ -292,12 +289,12 @@ // (and only then), also verify that the resulted // string matches the expected result const std::size_t match = - rw_match (cs.res, s_res.c_str(), cs.nres); + rw_match (tcase.res, s_res.c_str(), tcase.nres); - rw_assert (match == res_len, 0, cs.line, + rw_assert (match == res_len, 0, tcase.line, "line %d. %{$FUNCALL} expected %{#*s}, " "got %{/*.*Gs}, difference at offset %zu", - __LINE__, int (cs.nres), cs.res, + __LINE__, int (tcase.nres), tcase.res, int (sizeof (charT)), int (s_res.size ()), s_res.c_str (), match); } @@ -307,21 +304,21 @@ catch (const std::out_of_range &ex) { caught = exceptions [1]; - rw_assert (caught == expected, 0, cs.line, + rw_assert (caught == expected, 0, tcase.line, "line %d. %{$FUNCALL} %{?}expected %s,%{:}" "unexpectedly%{;} caught std::%s(%#s)", __LINE__, 0 != expected, expected, caught, ex.what ()); } catch (const std::exception &ex) { caught = exceptions [4]; - rw_assert (0, 0, cs.line, + rw_assert (0, 0, tcase.line, "line %d. %{$FUNCALL} %{?}expected %s,%{:}" "unexpectedly%{;} caught std::%s(%#s)", __LINE__, 0 != expected, expected, caught, ex.what ()); } catch (...) { caught = exceptions [0]; - rw_assert (0, 0, cs.line, + rw_assert (0, 0, tcase.line, "line %d. %{$FUNCALL} %{?}expected %s,%{:}" "unexpectedly%{;} caught %s", __LINE__, 0 != expected, expected, caught); @@ -331,7 +328,7 @@ // verify that an exception thrown during allocation // didn't cause a change in the state of the object str_state.assert_equal (rw_get_string_state (str), - __LINE__, cs.line, caught); + __LINE__, tcase.line, caught); } #endif // _RWSTD_NO_EXCEPTIONS Modified: incubator/stdcxx/trunk/tests/strings/21.string.swap.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.swap.cpp?rev=407913&r1=407912&r2=407913&view=diff ============================================================================== --- incubator/stdcxx/trunk/tests/strings/21.string.swap.cpp (original) +++ incubator/stdcxx/trunk/tests/strings/21.string.swap.cpp Fri May 19 14:16:38 2006 @@ -40,10 +40,8 @@ // for convenience and brevity #define Swap(which) StringMembers::swap_ ## which -typedef StringMembers::OverloadId OverloadId; typedef StringMembers::TestCase TestCase; -typedef StringMembers::Test Test; -typedef StringMembers::Function MemFun; +typedef StringMembers::Function Function; static const char* const exceptions[] = { "unknown exception", "out_of_range", "length_error", @@ -110,14 +108,12 @@ template void test_swap (charT, Traits*, Allocator*, - OverloadId which, + const Function&, const TestCase &tcase) { typedef std::basic_string String; typedef UserTraits::MemFun UTMemFun; - _RWSTD_UNUSED (which); - static const std::size_t BUFSIZE = 256; static charT wstr_buf [BUFSIZE]; @@ -130,8 +126,8 @@ charT* warg = rw_expand (warg_buf, tcase.arg, tcase.arg_len, &arg_len); // construct the string object and the argument string - String s_str (wstr, str_len); - String s_arg (warg, arg_len); + String s_str (wstr, str_len); + String s_arg (warg, arg_len); if (wstr != wstr_buf) delete[] wstr; @@ -153,7 +149,7 @@ const charT* const p1 = s_str.data (); const charT* const p2 = tcase.arg ? s_arg.data () : s_str.data (); - const char* src = tcase.arg ? tcase.arg : tcase.str; + const char* const src = tcase.arg ? tcase.arg : tcase.str; const std::size_t src_len = tcase.arg ? tcase.arg_len : tcase.str_len; String& arg_str = tcase.arg ? s_arg : s_str;