Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 83483 invoked from network); 14 Mar 2006 16:31:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Mar 2006 16:31:45 -0000 Received: (qmail 27000 invoked by uid 500); 14 Mar 2006 16:31:45 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 26988 invoked by uid 500); 14 Mar 2006 16:31:44 -0000 Mailing-List: contact stdcxx-dev-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-dev@incubator.apache.org Received: (qmail 26977 invoked by uid 99); 14 Mar 2006 16:31:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Mar 2006 08:31:44 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of AntonP@moscow.vdiweb.com designates 195.210.189.132 as permitted sender) Received: from [195.210.189.132] (HELO exmsk.moscow.vdiweb.com) (195.210.189.132) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Mar 2006 08:31:43 -0800 Received: from [10.11.0.125] ([10.11.0.125]) by exmsk.moscow.vdiweb.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 14 Mar 2006 19:31:18 +0300 Message-ID: <4416EFD1.6060503@moscow.vdiweb.com> Date: Tue, 14 Mar 2006 19:31:13 +0300 From: Anton Pevtsov User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040514 X-Accept-Language: en-us, en MIME-Version: 1.0 To: stdcxx-dev@incubator.apache.org Subject: Re: Re: test for 21.string::erase Content-Type: multipart/mixed; boundary="------------000805000009080708080707" X-OriginalArrivalTime: 14 Mar 2006 16:31:18.0592 (UTC) FILETIME=[B8A82400:01C64784] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------000805000009080708080707 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I've added command line options: --no-exceptions, --no-erase, --no-erase-iterator, --no-erase-range, --no-erase-pos, and no-erase-count. The attached file contains the patch for the test. Here is the ChangeLog: 2006-03-14 Anton Pevtsov * 21.string.erase.cpp: (rw_opt_no_exceptions, rw_opt_no_erase, rw_opt_no_erase_pos, rw_opt_no_erase_count, rw_opt_no_erase_iterator, rw_opt_no_erase_range) : New command line options. (test_erase) : Added check for the --no-exceptions option. (note_test_disabled) : New function to display the disable note. (run_test) : Changed to support new command line options. (main) : Added new command line options. Thanks, Anton Pevtsov -----Original Message----- From: Martin Sebor [mailto:sebor@roguewave.com] Sent: Sunday, March 12, 2006 04:08 To: stdcxx-dev@incubator.apache.org Subject: Re: test for 21.string::erase Anton Pevtsov wrote: >> The attached file contains new version of the test for string::erase. >> I merged tests for all erase versions into one function and added >> UserChar's tests. > > Okay, thanks. I found a few small problems and decided to correct them myself and commit the result -- see: http://svn.apache.org/viewcvs?rev=385224&view=rev Attached is a diff of the changes. The most important one is to the CALLFMT and CALLARGS macros where the test would fail to print the string argument past the first NUL. The other (minor) issues were the bad spelling of the $Id$ RCS keyword (missing closing $) and the file name (should be 21.string.erase). Please look over the diff so that we can avoid running into the same issues in the future :) Also, I would like each test to be able to disable exceptions using a command line option (say, "--no-exceptions"). Could you please add this capability to this test? Finally, it would be good to provide options to disable each overload of the tested function, i.e., --no-erase, --no-erase-iterator, --no-erase-range, --no-erase-pos, and no-erase-count. Let's also use this naming convention in the rest of the string and container tests. We should also have a uniform naming convention for the options that control the user defined character type and user-defined traits (I used --no-UserTraits in 0.char.cpp but I am willing to change it to --no-user_traits of you like that better). Thanks again. Martin --------------000805000009080708080707 Content-Type: text/plain; name="21.string.erase.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="21.string.erase.diff" Index: 21.string.erase.cpp =================================================================== --- 21.string.erase.cpp (revision 385808) +++ 21.string.erase.cpp (working copy) @@ -243,7 +243,6 @@ CALLARGS, int (sizeof (charT)), pstr, res); } - /**************************************************************************/ static void @@ -294,6 +293,20 @@ /**************************************************************************/ +static int rw_opt_no_char_traits; // for --no-char_traits +static int rw_opt_no_user_traits; // for --no-user_traits + +static int rw_opt_no_user_chars; // for --no-user_chars +static int rw_opt_no_exceptions; // for --no-exceptions + +static int rw_opt_no_erase; // for --no-erase +static int rw_opt_no_erase_pos; // for --no-erase-pos +static int rw_opt_no_erase_count; // for --no-erase-count +static int rw_opt_no_erase_iterator; // for --no-erase-iterator +static int rw_opt_no_erase_range; // for --no-erase-range + +/**************************************************************************/ + static void test_erase (MemFun *pfid, int which) { @@ -385,9 +398,11 @@ #ifndef _RWSTD_NO_EXCEPTIONS - TEST ("\0", 2, 1, "\0", true); - TEST ("a", 2, 1, "a", true); - TEST (long_string, long_string_len + 1, 1, long_string, true); + if (! rw_opt_no_exceptions) { + TEST ("\0", 2, 1, "\0", true); + TEST ("a", 2, 1, "a", true); + TEST (long_string, long_string_len + 1, 1, long_string, true); + } #endif // _RWSTD_NO_EXCEPTIONS @@ -423,27 +438,47 @@ /**************************************************************************/ -static int rw_opt_no_char_traits; // for --no-char_traits -static int rw_opt_no_user_traits; // for --no-user_traits -static int rw_opt_no_user_chars; // for --no-user_chars +static void +note_test_disabled (MemFun *pfid, int which) +{ + rw_note (0, 0, 0, "std::basic_string<%s, %s<%1$s>, %s<%1$s>>::" + "erase (%{?}%{?}size_type pos%{;}%{?}, size_type n%{;}%{;}" + "%{?}iterator first%{?}, iterator last%{;}%{;}) " + "test disabled", + pfid->cname_, pfid->tname_, pfid->aname_, 4 > which, + 2 == which || 3 == which, 3 == which, 4 <= which, which == 5); +} -/**************************************************************************/ - static void run_test (MemFun *pfid) { - if (pfid->tname_ && rw_opt_no_user_traits) { + if (MemFun::UserTraits == pfid->tid_ && rw_opt_no_user_traits) { rw_note (1 < rw_opt_no_user_traits++, 0, 0, - "user defined traits test disabled"); + "user defined traits tests disabled"); } - else if (!pfid->tname_ && rw_opt_no_char_traits) { + else if (MemFun::DefaultTraits == pfid->tid_ && rw_opt_no_char_traits) { rw_note (1 < rw_opt_no_char_traits++, 0, 0, - "char_traits test disabled"); + "char_traits tests disabled"); } else { + + if (rw_opt_no_exceptions) + rw_note (1 < rw_opt_no_exceptions++, 0, 0, + "string::erase exceptions tests disabled"); + // exercise all erase overloads - for (int i = 1; i <= 5; i++) - test_erase (pfid, i); +#undef TEST +#define TEST(option, n) \ + if (option) \ + note_test_disabled (pfid, n); \ + else \ + test_erase (pfid, n); + + TEST (rw_opt_no_erase, 1); + TEST (rw_opt_no_erase_pos, 2); + TEST (rw_opt_no_erase_count, 3); + TEST (rw_opt_no_erase_iterator, 4); + TEST (rw_opt_no_erase_range, 5); } } @@ -512,9 +547,21 @@ 0 /* no comment */, run_test, "|-no-char_traits# " - "|-no-user_traits# ", - "|-no-user_chars", + "|-no-user_traits# " + "|-no-user_chars# " + "|-no-exceptions# " + "|-no-erase# " + "|-no-erase-pos# " + "|-no-erase-count# " + "|-no-erase-iterator# " + "|-no-erase-range", &rw_opt_no_char_traits, &rw_opt_no_user_traits, - &rw_opt_no_user_chars); + &rw_opt_no_user_chars, + &rw_opt_no_exceptions, + &rw_opt_no_erase, + &rw_opt_no_erase_pos, + &rw_opt_no_erase_count, + &rw_opt_no_erase_iterator, + &rw_opt_no_erase_range); } --------------000805000009080708080707--