Author: sebor
Date: Fri May 5 09:00:32 2006
New Revision: 400096
URL: http://svn.apache.org/viewcvs?rev=400096&view=rev
Log:
2006-05-05 Anton Pevtsov <[EMAIL PROTECTED]>
* 21.strings.h (MemberId): Added new elements for access, copy.
(OverloadId): Added new enum elements for access and copy overloads.
* 21.strings.cpp (_rw_setvars): Added support for access and copy
overloads.
* 21.string.copy.cpp: Converted to simplified format.
(MemFun, run_test): removed as obsolete.
(test_copy): Updated to use test driver features.
Modified:
incubator/stdcxx/trunk/tests/include/21.strings.h
incubator/stdcxx/trunk/tests/src/21.strings.cpp
incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp
Modified: incubator/stdcxx/trunk/tests/include/21.strings.h
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/include/21.strings.h?rev=400096&r1=400095&r2=400096&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/include/21.strings.h (original)
+++ incubator/stdcxx/trunk/tests/include/21.strings.h Fri May 5 09:00:32 2006
@@ -128,11 +128,14 @@
mem_find_last_not_of = 1 << 17,
mem_compare = 1 << 18,
mem_substr = 1 << 19,
+ mem_access = 1 << 20,
+ mem_copy = 1 << 21,
mem_mask =
mem_append | mem_assign | mem_erase | mem_insert |
mem_replace | mem_op_plus_eq | mem_find | mem_rfind |
mem_find_first_of | mem_find_last_of | mem_find_first_not_of |
- mem_find_last_not_of | mem_compare | mem_substr
+ mem_find_last_not_of | mem_compare | mem_substr | mem_access |
+ mem_copy
};
// unique identifiers for all overloads of each member function
@@ -348,7 +351,18 @@
// substr (size_type)
substr_size = mem_substr + sig_size,
// substr (size_type, size_type)
- substr_size_size = mem_substr + sig_size_size
+ substr_size_size = mem_substr + sig_size_size,
+
+ //////////////////////////////////////////////////////////////
+ // operator[] (size_type)
+ // at (size_type)
+ access_size = mem_access + sig_size,
+
+ //////////////////////////////////////////////////////////////
+ // copy (value_type*, size_type)
+ copy_ptr_size = mem_copy + sig_ptr_size,
+ // copy (value_type*, size_type, size_type)
+ copy_ptr_size_size = mem_copy + sig_ptr_size_size
};
Modified: incubator/stdcxx/trunk/tests/src/21.strings.cpp
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/src/21.strings.cpp?rev=400096&r1=400095&r2=400096&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/21.strings.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/21.strings.cpp Fri May 5 09:00:32 2006
@@ -63,7 +63,7 @@
_rw_memfun_names[] = {
"append", "assign", "erase", "insert", "replace", "operator+=", "find",
"rfind", "find_first_of", "find_last_of", "find_first_not_of",
- "find_last_not_of", "compare", "substr"
+ "find_last_not_of", "compare", "substr", "operator[]", "copy"
};
/**************************************************************************/
@@ -290,6 +290,7 @@
case StringMembers::append_ptr_size:
case StringMembers::assign_ptr_size:
+ case StringMembers::copy_ptr_size:
rw_asnprintf (&buf, &bufsize, "%{+}("
"%{?}%{#*s}%{;}%{?}this->c_str ()%{;}, %zu)",
!self, int (pcase->arg_len), pcase->arg,
@@ -332,6 +333,13 @@
self, pcase->off, pcase->size);
break;
+ case StringMembers::copy_ptr_size_size:
+ rw_asnprintf (&buf, &bufsize, "%{+}("
+ "%{?}%{#*s}%{;}%{?}this->c_str ()%{;}, %zu, %zu)",
+ !self, int (pcase->arg_len), pcase->arg,
+ self, pcase->size, pcase->off);
+ break;
+
case StringMembers::append_str_size_size:
case StringMembers::assign_str_size_size:
rw_asnprintf (&buf, &bufsize, "%{+}("
@@ -518,6 +526,7 @@
case StringMembers::erase_size:
case StringMembers::substr_size:
+ case StringMembers::access_size:
rw_asnprintf (&buf, &bufsize,
"%{+} (%zu)", pcase->off);
break;
Modified: incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp?rev=400096&r1=400095&r2=400096&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp Fri May 5 09:00:32
2006
@@ -26,69 +26,87 @@
**************************************************************************/
#include <string> // for string
-#include <cstddef> // for size_t
+#include <cstddef> // size_t
#include <stdexcept> // for out_of_range
-#include <cmdopt.h> // for rw_enabled()
-#include <driver.h> // for rw_test()
-
+#include <21.strings.h> // for StringMembers
+#include <driver.h> // for rw_assert()
#include <rw_char.h> // for rw_widen()
/**************************************************************************/
-struct MemFun
-{
- enum charT { Char, WChar, UChar };
- enum Traits { DefaultTraits, UserTraits };
+// for convenience and brevity
- MemFun (charT cid, const char *cname,
- Traits tid, const char *tname)
- : cid_ (cid), tid_ (tid),
- cname_ (cname), tname_ (tname), aname_ ("allocator"),
- fname_ ("copy") { /* empty */ }
-
- charT cid_; // character type id (char or wchar_t)
- Traits tid_; // traits type id (default or user-defined)
- const char *cname_; // character type name
- const char *tname_; // traits name
- const char *aname_; // allocator name
- const char *fname_; // function name
+#define NPOS _RWSTD_SIZE_MAX
+#define LSTR StringMembers::long_string
+#define LLEN StringMembers::long_string_len
+#define Copy(which) StringMembers::copy_ ## which
+
+typedef StringMembers::OverloadId OverloadId;
+typedef StringMembers::TestCase TestCase;
+typedef StringMembers::Test Test;
+typedef StringMembers::Function MemFun;
+
+static const char* const exceptions[] = {
+ "unknown exception", "out_of_range", "length_error",
+ "bad_alloc", "exception"
};
/**************************************************************************/
-static const int long_string_len = 4096;
-static char long_string [long_string_len];
+// exercises:
+// copy (value_type*, size_type)
+static const TestCase
+ptr_size_test_cases [] = {
-// for convenience and brevity
-#define LSTR long_string
-#define LLEN long_string_len
+#undef TEST
+#define TEST(str, size, res) { \
+ __LINE__, -1, size, -1, -1, -1, \
+ str, sizeof str - 1, 0, 0, \
+ res, sizeof res - 1, 0 \
+ }
+
+ // +--------------------------------------- controlled sequence
+ // | +--------------------- copy() n argument
+ // | | +----------------- expected result sequence
+ // | | |
+ // V V V
+ TEST ("ab", 2, "ab"),
+
+ TEST ("", 0, ""),
+ TEST ("", 10, ""),
+
+ TEST ("\0", 1, "\0"),
+ TEST ("\0\0", 2, "\0\0"),
+
+ TEST ("abc", 0, ""),
+ TEST ("abc", 1, "a"),
+ TEST ("abc", 2, "ab"),
+ TEST ("abc", 3, "abc"),
+ TEST ("abc", 5, "abc"),
+
+ TEST ("a\0b\0\0c", 10, "a\0b\0\0c"),
+ TEST ("\0ab\0\0\0c\0", 1, "\0"),
+ TEST ("\0ab\0\0\0c\0", 8, "\0ab\0\0\0c\0"),
+ TEST ("\0ab\0\0\0c\0", 5, "\0ab\0\0"),
+ TEST ("\0\0ab\0\0c\0", 6, "\0\0ab\0\0"),
-static const char* exp_exceptions[] =
- { "unknown exception", "out_of_range" };
+ TEST ("last", 4, "last")
+};
/**************************************************************************/
-static const struct TestCase {
-
- int line;
-
- int cnt;
- int pos;
-
- const char* str;
- std::size_t str_len;
-
- const char* res;
- std::size_t res_len;
-
- int bthrow;
-
-} test_cases [] = {
+// exercises:
+// copy (value_type*, size_type, size_type)
+static const TestCase
+ptr_size_size_test_cases [] = {
#undef TEST
-#define TEST(str, cnt, pos, res, bthrow) \
- { __LINE__, cnt, pos, str, sizeof str - 1, res, sizeof res - 1, bthrow }
+#define TEST(str, size, off, res, bthrow) { \
+ __LINE__, off, size, -1, -1, -1, \
+ str, sizeof str - 1, 0, 0, \
+ res, sizeof res - 1, bthrow \
+ }
// +------------------------------------------ controlled sequence
// | +------------------------ copy() n argument
@@ -98,75 +116,68 @@
// | | | | | 0 - no exception
// | | | | | 1 - out_of_range
// V V V V V
- TEST ("ab", 2, -1, "ab", 0),
+ TEST ("ab", 2, 0, "ab", 0),
- TEST ("", 0, -1, "", 0),
- TEST ("", 10, -1, "", 0),
+ TEST ("", 0, 0, "", 0),
+ TEST ("", 10, 0, "", 0),
- TEST ("\0", 1, -1, "\0", 0),
+ TEST ("\0", 1, 0, "\0", 0),
TEST ("\0\0", 1, 1, "\0", 0),
- TEST ("\0\0", 2, -1, "\0\0", 0),
+ TEST ("\0\0", 2, 0, "\0\0", 0),
- TEST ("abc", 1, -1, "a", 0),
+ TEST ("abc", 1, 0, "a", 0),
TEST ("abc", 1, 1, "b", 0),
TEST ("abc", 1, 2, "c", 0),
- TEST ("abc", 0, -1, "", 0),
- TEST ("abc", 2, -1, "ab", 0),
+ TEST ("abc", 0, 0, "", 0),
+ TEST ("abc", 2, 0, "ab", 0),
TEST ("abc", 2, 1, "bc", 0),
- TEST ("abc", 3, -1, "abc", 0),
+ TEST ("abc", 3, 0, "abc", 0),
TEST ("abc", 10, 1, "bc", 0),
TEST ("abc", 3, 2, "c", 0),
TEST ("a\0b\0\0c", 10, 1, "\0b\0\0c", 0),
- TEST ("a\0b\0\0c", 10, -1, "a\0b\0\0c", 0),
+ TEST ("a\0b\0\0c", 10, 0, "a\0b\0\0c", 0),
TEST ("a\0b\0\0c", 1, 1, "\0", 0),
TEST ("\0ab\0\0\0c\0", 10, 1, "ab\0\0\0c\0",0),
- TEST ("\0ab\0\0\0c\0", 5, -1, "\0ab\0\0", 0),
+ TEST ("\0ab\0\0\0c\0", 5, 0, "\0ab\0\0", 0),
TEST ("\0ab\0\0\0c\0", 3, 3, "\0\0\0", 0),
- TEST ("\0\0ab\0\0c\0", 6, -1, "\0\0ab\0\0", 0),
+ TEST ("\0\0ab\0\0c\0", 6, 0, "\0\0ab\0\0", 0),
TEST ("\0\0ab\0\0c\0", 4, 1, "\0ab\0", 0),
- TEST (LSTR, LLEN - 1, -1, LSTR, 0),
+ TEST (LSTR, LLEN - 1, 0, LSTR, 0),
TEST (LSTR, 2, 1, "xx", 0),
TEST (LSTR, LLEN - 1, LLEN - 2, "x", 0),
-#ifndef _RWSTD_NO_EXCEPTIONS
-
- TEST ("\0", 0, 2, "", 1),
- TEST ("a", 0, 10, "", 1),
- TEST (LSTR, 0, LLEN + 10, "", 1),
+ TEST ("\0", 0, 2, "", 1),
+ TEST ("a", 0, 10, "", 1),
+ TEST (LSTR, 0, LLEN + 10, "", 1),
-#endif // _RWSTD_NO_EXCEPTIONS
-
- TEST ("last", 4, -1, "last", 0)
+ TEST ("last", 4, 0, "last", 0)
};
/**************************************************************************/
template <class charT, class Traits>
void test_copy (charT, Traits*,
- const MemFun *pfid,
- const TestCase &cs)
+ OverloadId which,
+ const TestCase &tcase)
{
- RW_ASSERT (0 != pfid);
-
- typedef std::basic_string <charT, Traits,
- std::allocator<charT> > TestString;
+ typedef std::allocator<charT> Allocator;
+ typedef std::basic_string <charT, Traits, Allocator> TestString;
static charT wstr [LLEN];
- static const charT eos = charT ();
-
- const bool use_pos = -1 != cs.pos;
// construct strings
- rw_widen (wstr, cs.str, cs.str_len);
- const TestString str (wstr, cs.str_len);
+ rw_widen (wstr, tcase.str, tcase.str_len);
+ const TestString str (wstr, tcase.str_len);
const std::size_t min_len =
- cs.str_len < std::size_t (cs.cnt) ? cs.str_len : cs.cnt;
+ tcase.str_len < std::size_t (tcase.size) ? tcase.str_len : tcase.size;
+
+ std::size_t res = 0;
// create destination array and initialize it with garbage
charT* const s_res = new charT [min_len + 1];
@@ -175,261 +186,125 @@
charT wcgb = make_char (cgb, (charT*)0);
Traits::assign (s_res, min_len + 1, wcgb);
- // (name of) expected and caught exception
- const char* expected = 0;
- const char* caught = 0;
+ // save the state of the string object before the call
+ // to detect wxception safety violations (changes to
+ // the state of the object after an exception)
+ const StringState str_state (rw_get_string_state (str));
#ifndef _RWSTD_NO_EXCEPTIONS
- expected = cs.bthrow && use_pos ? exp_exceptions [1] : 0;
-
- try {
-
-#endif // _RWSTD_NO_EXCEPTIONS
-
- const typename TestString::size_type res = use_pos ?
- str.copy (s_res, cs.cnt, cs.pos)
- : str.copy (s_res, cs.cnt);
-
-#define CALLFMAT \
- "line %d. std::basic_string<%s, %s<%2$s>, %s<%2$s>>" \
- "(%{#*s}).copy (%{#*s}, %zu%{?}, %zu%{;})"
-
-#define CALLARGS \
- __LINE__, pfid->cname_, pfid->tname_, pfid->aname_, \
- int (cs.str_len), cs.str, 1, &eos, cs.cnt, \
- use_pos, cs.pos
-
- // verify the returned value
- rw_assert (res == cs.res_len, 0, cs.line,
- CALLFMAT " == %zu, got %zu",
- CALLARGS, cs.res_len, res);
-
- std::size_t match = rw_match (cs.res, s_res, cs.res_len);
- bool success = match == cs.res_len;
-
- rw_assert (success, 0, cs.line,
- CALLFMAT " expected %{#*s}, got %{/*.*Gs}, differ at pos %zu",
- CALLARGS, int (cs.res_len), cs.res,
- int (sizeof (charT)), int (res), s_res, match);
-
- success = 1 == rw_match (&cgb, &s_res [min_len], 1);
- rw_assert (success, 0, cs.line,
- CALLFMAT " detected writing past the end of "
- "the provided buffer", CALLARGS);
-
-#ifndef _RWSTD_NO_EXCEPTIONS
-
- }
- catch (std::out_of_range) {
- caught = exp_exceptions [1];
- }
- catch (...) {
- caught = exp_exceptions [0];
- }
+ // is some exception expected?
+ const char* const expected = tcase.bthrow ? exceptions [1] : 0;
+ const char* caught = 0;
#else // if defined (_RWSTD_NO_EXCEPTIONS)
-#endif // _RWSTD_NO_EXCEPTIONS
-
- rw_assert (caught == expected, 0, cs.line,
- CALLFMAT " %{?}expected %s, caught %s"
- "%{:}unexpectedly caught %s%{;}",
- CALLARGS, 0 != expected, expected, caught, caught);
-
- delete[] s_res;
-}
-
-/**************************************************************************/
-
-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_copy; // for --no-copy
-static int rw_opt_no_copy_pos; // for --no-copy-pos
-
-/**************************************************************************/
-
-static void
-note_test_disabled (const MemFun *pfid, bool use_pos)
-{
- RW_ASSERT (0 != pfid);
-
- rw_note (0, 0, 0, "std::basic_string<%s, %s<%1$s>, %s<%1$s>>::"
- "copy (charT* s, size_type n%{?}, size_type pos%{;}) "
- "test disbled",
- pfid->cname_, pfid->tname_, pfid->aname_, use_pos);
-}
-
-static void
-test_copy (const MemFun *pfid)
-{
- RW_ASSERT (0 != pfid);
-
- rw_info (0, 0, 0, "std::basic_string<%s, %s<%1$s>, %s<%1$s>>::"
- "copy (charT* s, size_type n, size_type pos = 0)",
- pfid->cname_, pfid->tname_, pfid->aname_);
-
- if (rw_opt_no_copy)
- note_test_disabled (pfid, false);
-
- if (rw_opt_no_copy_pos)
- note_test_disabled (pfid, true);
+ if (tcase.bthrow)
+ return;
-#undef TEST
-#define TEST(charT, Traits, cs) \
- test_copy (charT(), (Traits*)0, pfid, cs)
-
- static const std::size_t ncases = sizeof test_cases / sizeof *test_cases;
-
- for (std::size_t i = 0; i != ncases; ++i) {
+#endif // _RWSTD_NO_EXCEPTIONS
- if (!rw_enabled (test_cases[i].line)) {
- rw_note (0, 0, __LINE__,
- "test on line %d disabled", test_cases[i].line);
- continue;
+ try {
+ switch (which) {
+ case Copy (ptr_size): {
+ res = str.copy (s_res, tcase.size);
+ break;
}
- // do not exercise copy (charT* s, size_type n)
- if (rw_opt_no_copy && -1 == test_cases[i].pos)
- continue;
-
- // do not exercise copy (charT* s, size_type n, size_type pos)
- if (rw_opt_no_copy_pos && -1 != test_cases[i].pos)
- continue;
-
- // do not exercise exceptions if they were disabled
- if (0 != rw_opt_no_exceptions && 0 != test_cases[i].bthrow)
- continue;
-
- if (MemFun:: DefaultTraits == pfid->tid_) {
- if (MemFun::Char == pfid->cid_)
- TEST (char, std::char_traits<char>, test_cases[i]);
-
-#ifndef _RWSTD_NO_WCHAR_T
- else
- TEST (wchar_t, std::char_traits<wchar_t>, test_cases[i]);
-#endif // _RWSTD_NO_WCHAR_T
-
+ case Copy (ptr_size_size): {
+ res = str.copy (s_res, tcase.size, tcase.off);
+ break;
}
- else {
- if (MemFun::Char == pfid->cid_)
- TEST (char, UserTraits<char>, test_cases[i]);
-
-#ifndef _RWSTD_NO_WCHAR_T
- else if (MemFun::WChar == pfid->cid_)
- TEST (wchar_t, UserTraits<wchar_t>, test_cases[i]);
-#endif // _RWSTD_NO_WCHAR_T
-
- else
- TEST (UserChar, UserTraits<UserChar>, test_cases[i]);
+ default:
+ RW_ASSERT (!"logic error: unknown copy overload");
+ return;
}
- }
-}
-/**************************************************************************/
+ // verify the returned value
+ rw_assert (res == tcase.nres, 0, tcase.line,
+ "line %d. %{$FUNCALL} == %zu, got %zu",
+ __LINE__, tcase.nres, res);
+
+ const std::size_t match = rw_match (tcase.res, s_res, tcase.nres);
+ bool success = match == tcase.nres;
+
+ rw_assert (success, 0, tcase.line,
+ "line %d. %{$FUNCALL} expected %{#*s}, "
+ "got %{/*.*Gs}, differ at pos %zu",
+ __LINE__, int (tcase.nres), tcase.res,
+ int (sizeof (charT)), int (res), s_res, match);
+
+ success = 1 == rw_match (&cgb, &s_res [min_len], 1);
+ rw_assert (success, 0, tcase.line,
+ "line %d. %{$FUNCALL} detected writing past the end of "
+ "the provided buffer", __LINE__);
+ }
-static void
-run_test (const MemFun *pfid)
-{
- RW_ASSERT (0 != pfid);
+#ifndef _RWSTD_NO_EXCEPTIONS
- 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");
+ catch (const std::out_of_range &ex) {
+ caught = exceptions [1];
+ 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, tcase.line,
+ "line %d. %{$FUNCALL} %{?}expected %s,%{:}"
+ "unexpectedly%{;} caught std::%s(%#s)",
+ __LINE__, 0 != expected, expected, caught, ex.what ());
}
- 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");
+ catch (...) {
+ caught = exceptions [0];
+ rw_assert (0, 0, tcase.line,
+ "line %d. %{$FUNCALL} %{?}expected %s,%{:}"
+ "unexpectedly%{;} caught %s",
+ __LINE__, 0 != expected, expected, caught);
+ }
+
+ if (caught) {
+ // 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__, tcase.line, caught);
+ }
+ else if (-1 != tcase.bthrow) {
+ rw_assert (caught == expected, 0, tcase.line,
+ "line %d. %{$FUNCALL} %{?}expected %s, caught %s"
+ "%{:}unexpectedly caught %s%{;}",
+ __LINE__, 0 != expected, expected, caught, caught);
}
- else {
- if (rw_opt_no_exceptions)
- rw_note (1 < rw_opt_no_exceptions++, 0, 0,
- "string::copy exceptions tests disabled");
+#endif // _RWSTD_NO_EXCEPTIONS
- test_copy (pfid);
- }
+ delete[] s_res;
}
/**************************************************************************/
-int run_test (int, char*[])
-{
- if ('\0' == LSTR [0]) {
- // initialize long_string
- for (std::size_t i = 0; i != sizeof LSTR - 1; ++i)
- LSTR [i] = 'x';
- }
-
- if (rw_enabled ("char")) {
-
- MemFun fid (MemFun::Char, "char", MemFun::DefaultTraits, 0);
-
- fid.tname_ = "char_traits";
-
- run_test (&fid);
-
- fid.tid_ = MemFun::UserTraits;
- fid.tname_ = "UserTraits";
-
- run_test (&fid);
- }
- else
- rw_note (0, 0, 0, "string::copy char tests disabled");
-
- if (rw_enabled ("wchar_t")) {
-
- MemFun fid (MemFun::WChar, "wchar_t", MemFun::DefaultTraits, 0);
-
- fid.tname_ = "char_traits";
-
- run_test (&fid);
+DEFINE_TEST_DISPATCH (test_copy);
- fid.tid_ = MemFun::UserTraits;
- fid.tname_ = "UserTraits";
+int main (int argc, char** argv)
+{
+ static const StringMembers::Test
+ tests [] = {
- run_test (&fid);
+#undef TEST
+#define TEST(tag) { \
+ StringMembers::copy_ ## tag, \
+ tag ## _test_cases, \
+ sizeof tag ## _test_cases / sizeof *tag ## _test_cases \
}
- else
- rw_note (0, 0, 0, "string::copy wchar tests disabled");
- if (rw_opt_no_user_chars) {
- rw_note (0, 0, 0, "user defined chars test disabled");
- }
- else {
- MemFun fid (MemFun::UChar, "UserChar", MemFun::UserTraits, 0);
- fid.tname_ = "UserTraits";
- run_test (&fid);
- }
+ TEST (ptr_size),
+ TEST (ptr_size_size)
+ };
- // silence a bogus EDG eccp remark #550-D:
- // variable "exp_exceptions" was set but never used
- _RWSTD_UNUSED (exp_exceptions);
+ const std::size_t test_count = sizeof tests / sizeof *tests;
- return 0;
-}
-
-/**************************************************************************/
-
-int main (int argc, char** argv)
-{
- return rw_test (argc, argv, __FILE__,
- "lib.string.copy",
- 0 /* no comment */, run_test,
- "|-no-char_traits# "
- "|-no-user_traits# "
- "|-no-user_chars# "
- "|-no-exceptions# "
- "|-no-copy# "
- "|-no-copy-pos#",
- &rw_opt_no_char_traits,
- &rw_opt_no_user_traits,
- &rw_opt_no_user_chars,
- &rw_opt_no_exceptions,
- &rw_opt_no_copy,
- &rw_opt_no_copy_pos);
+ return StringMembers::run_test (argc, argv, __FILE__,
+ "lib.string.copy",
+ test_copy, tests, test_count);
}