You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/05/19 23:16:39 UTC
svn commit: r407913 [1/2] - in /incubator/stdcxx/trunk/tests: include/
strings/
Author: sebor
Date: Fri May 19 14:16:38 2006
New Revision: 407913
URL: http://svn.apache.org/viewvc?rev=407913&view=rev
Log:
2006-05-19 Martin Sebor <se...@roguewave.com>
* 21.strings.h (TEST_DISPATCH): Passed the entire Function object
to the test function template, not just the OverloadId member.
* 21.string.access.cpp (OverloadId, Test): Removed unused typedefs.
(Function): New convenience typedef.
(test_access): Changed signature to take a Function argument
rather than just OverloadId. Renamed the cs formal argument
to tcase to make it more understandable and for consistency
with other tests.
* 21.string.append.cpp: Same.
* 21.string.assign.cpp: Same.
* 21.string.compare.cpp: Same.
* 21.string.cons.cpp: Same.
* 21.string.copy.cpp: Same.
* 21.string.erase.cpp: Same.
* 21.string.find.cpp: Same.
* 21.string.find.first.not.of.cpp: Same.
* 21.string.find.first.of.cpp: Same.
* 21.string.find.last.not.of.cpp: Same.
* 21.string.find.last.of.cpp: Same.
* 21.string.insert.cpp: Same.
* 21.string.plus_equal.cpp: Same.
* 21.string.replace.cpp: Same.
* 21.string.rfind.cpp: Same.
* 21.string.substr.cpp: Same.
* 21.string.swap.cpp: Same.
Modified:
incubator/stdcxx/trunk/tests/include/21.strings.h
incubator/stdcxx/trunk/tests/strings/21.string.access.cpp
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.compare.cpp
incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp
incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp
incubator/stdcxx/trunk/tests/strings/21.string.erase.cpp
incubator/stdcxx/trunk/tests/strings/21.string.find.cpp
incubator/stdcxx/trunk/tests/strings/21.string.find.first.not.of.cpp
incubator/stdcxx/trunk/tests/strings/21.string.find.first.of.cpp
incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp
incubator/stdcxx/trunk/tests/strings/21.string.find.last.of.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
incubator/stdcxx/trunk/tests/strings/21.string.rfind.cpp
incubator/stdcxx/trunk/tests/strings/21.string.substr.cpp
incubator/stdcxx/trunk/tests/strings/21.string.swap.cpp
Modified: incubator/stdcxx/trunk/tests/include/21.strings.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/include/21.strings.h?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/include/21.strings.h (original)
+++ incubator/stdcxx/trunk/tests/include/21.strings.h Fri May 19 14:16:38 2006
@@ -505,10 +505,10 @@
if (StringMembers::DefaultTraits == memfun.traits_id_) { \
if (StringMembers::Char == memfun.char_id_) \
fname (char (), (std::char_traits<char>*)0, \
- (Alloc<char>*)0, memfun.which_, tcase); \
+ (Alloc<char>*)0, memfun, tcase); \
else if (StringMembers::WChar == memfun.char_id_) \
fname (wchar_t (), (std::char_traits<wchar_t>*)0, \
- (Alloc<wchar_t>*)0, memfun.which_, tcase); \
+ (Alloc<wchar_t>*)0, memfun, tcase); \
else \
rw_note (0, 0, 0, \
"%{$CLASS} tests not implemented"); \
@@ -516,13 +516,13 @@
else { \
if (StringMembers::Char == memfun.char_id_) \
fname (char (), (UserTraits<char>*)0, \
- (Alloc<char>*)0, memfun.which_, tcase); \
+ (Alloc<char>*)0, memfun, tcase); \
else if (StringMembers::WChar == memfun.char_id_) \
fname (wchar_t (), (UserTraits<wchar_t>*)0, \
- (Alloc<wchar_t>*)0, memfun.which_, tcase); \
+ (Alloc<wchar_t>*)0, memfun, tcase); \
else \
fname (UserChar (), (UserTraits<UserChar>*)0, \
- (Alloc<UserChar>*)0, memfun.which_, tcase); \
+ (Alloc<UserChar>*)0, memfun, tcase); \
} \
(void)0
@@ -531,7 +531,7 @@
if (StringMembers::DefaultTraits == memfun.traits_id_) { \
if (StringMembers::Char == memfun.char_id_) \
fname (char (), (std::char_traits<char>*)0, \
- (Alloc<char>*)0, memfun.which_, tcase); \
+ (Alloc<char>*)0, memfun, tcase); \
else if (StringMembers::WChar == memfun.char_id_) \
RW_ASSERT (!"logic error: wchar_t disabled"); \
else \
@@ -542,12 +542,12 @@
else { \
if (StringMembers::Char == memfun.char_id_) \
fname (char (), (UserTraits<char>*)0, \
- (Alloc<char>*)0, memfun.which_, tcase); \
+ (Alloc<char>*)0, memfun, tcase); \
else if (StringMembers::WChar == memfun.char_id_) \
RW_ASSERT (!"logic error: wchar_t disabled"); \
else if (StringMembers::UChar == memfun.char_id_) \
fname (UserChar (), (UserTraits<UserChar>*)0, \
- (Alloc<UserChar>*)0, memfun.which_, tcase); \
+ (Alloc<UserChar>*)0, memfun, tcase); \
} \
(void)0
Modified: incubator/stdcxx/trunk/tests/strings/21.string.access.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.access.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.access.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.access.cpp Fri May 19 14:16:38 2006
@@ -1,6 +1,6 @@
/***************************************************************************
*
- * access.cpp - test exercising [lib.string.access]
+ * 21.string.access.cpp - test exercising [lib.string.access]
*
* $Id$
*
@@ -35,10 +35,8 @@
#define At(which) StringMembers::at_ ## which
#define OpIndex(which) StringMembers::op_index_ ## 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",
@@ -204,8 +202,8 @@
template <class charT, class Traits, class Allocator>
void test_access (charT, Traits*, Allocator*,
- OverloadId which,
- const TestCase &cs)
+ const Function &func,
+ const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
typedef typename String::reference StrRef;
@@ -215,10 +213,10 @@
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);
// construct the string object
- String s_str (wstr, str_len);
+ String s_str (wstr, str_len);
if (wstr != wstr_buf)
delete[] wstr;
@@ -233,7 +231,7 @@
#ifndef _RWSTD_NO_EXCEPTIONS
// is some exception expected ?
- const char* expected = 1 == cs.bthrow ? exceptions[1] : 0;
+ const char* expected = 1 == tcase.bthrow ? exceptions[1] : 0;
const char* caught = 0;
#endif // _RWSTD_NO_EXCEPTIONS
@@ -242,34 +240,32 @@
bool success = false;
charT cres;
- char exp_res = NPOS != cs.nres
- ? (char) cs.nres
- : typename std::string::value_type();
+ char exp_res = NPOS != tcase.nres ? char (tcase.nres) : char ();
- switch (which) {
+ switch (func.which_) {
case OpIndex (size): {
- StrRef res = s_str [cs.off];
+ StrRef res = s_str [tcase.off];
success = 1 == rw_match (&exp_res, &res, 1);
cres = res;
break;
}
case OpIndex (size_const): {
- StrConstRef res = const_cast<const String&>(s_str) [cs.off];
+ StrConstRef res = const_cast<const String&>(s_str) [tcase.off];
success = 1 == rw_match (&exp_res, &res, 1);
cres = res;
break;
}
case At (size): {
- StrRef res = s_str.at (cs.off);
+ StrRef res = s_str.at (tcase.off);
success = 1 == rw_match (&exp_res, &res, 1);
cres = res;
break;
}
case At (size_const): {
- StrConstRef res = const_cast<const String&>(s_str).at (cs.off);
+ StrConstRef res = const_cast<const String&>(s_str).at (tcase.off);
success = 1 == rw_match (&exp_res, &res, 1);
cres = res;
@@ -280,30 +276,30 @@
return;
}
- rw_assert (success, 0, cs.line,
+ rw_assert (success, 0, tcase.line,
"line %d. %{$FUNCALL} == %{#c}, got %{#c}",
- __LINE__, cs.nres, cres);
+ __LINE__, tcase.nres, cres);
}
#ifndef _RWSTD_NO_EXCEPTIONS
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);
@@ -315,7 +311,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 (s_str),
- __LINE__, cs.line, caught);
+ __LINE__, tcase.line, caught);
}
}
Modified: incubator/stdcxx/trunk/tests/strings/21.string.append.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.append.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.append.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.append.cpp Fri May 19 14:16:38 2006
@@ -42,10 +42,8 @@
#define Append(which) StringMembers::append_ ## which
#define PushBack(which) StringMembers::push_back_ ## 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[] = {
@@ -535,7 +533,7 @@
template <class charT, class Traits, class Allocator>
void test_append (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -558,7 +556,7 @@
charT* wres = rw_expand (wres_buf, tcase.res, tcase.nres, &res_len);
// special processing for append_range to exercise all iterators
- if (Append (range) == which) {
+ if (Append (range) == func.which_) {
test_append_range (wstr, str_len, warg, arg_len, res_len,
(Traits*)0, (Allocator*)0, tcase);
@@ -620,7 +618,7 @@
#ifndef _RWSTD_NO_EXCEPTIONS
- if (1 == tcase.bthrow && Append (str_size_size) == which)
+ if (1 == tcase.bthrow && Append (str_size_size) == func.which_)
expected = exceptions [1]; // out_of_range
else if (2 == tcase.bthrow)
expected = exceptions [2]; // length_error
@@ -642,7 +640,7 @@
try {
- switch (which) {
+ switch (func.which_) {
case Append (ptr): {
const String& s_res = s_str.append (ptr_arg);
res_off = &s_res - &s_str;
@@ -686,7 +684,7 @@
}
// verify the returned value
- if (PushBack (val) != which) {
+ if (PushBack (val) != func.which_) {
rw_assert (0 == res_off, 0, tcase.line,
"line %d. %{$FUNCALL} returned invalid reference, "
"offset is %zu", __LINE__, res_off);
@@ -716,7 +714,7 @@
}
// verify that Traits::length was used
- if (Append (ptr) == which && rg_calls) {
+ if (Append (ptr) == func.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.assign.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.assign.cpp Fri May 19 14:16:38 2006
@@ -41,10 +41,8 @@
// for convenience and brevity
#define Assign(which) StringMembers::assign_ ## which
-typedef StringMembers::OverloadId AssignOverload;
typedef StringMembers::TestCase TestCase;
-typedef StringMembers::Test Test;
-typedef StringMembers::Function MemFun;
+typedef StringMembers::Function Function;
static const char* const exceptions[] = {
@@ -496,7 +494,7 @@
template <class charT, class Traits, class Allocator>
void test_assign (charT, Traits*, Allocator*,
- AssignOverload which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -519,7 +517,7 @@
charT* wres = rw_expand (wres_buf, tcase.res, tcase.nres, &res_len);
// special processing for assign_range to exercise all iterators
- if (Assign (range) == which) {
+ if (Assign (range) == func.which_) {
test_assign_range (wstr, str_len, warg, arg_len,
res_len, (Traits*)0, (Allocator*)0, tcase);
@@ -582,7 +580,7 @@
#ifndef _RWSTD_NO_EXCEPTIONS
- if (1 == tcase.bthrow && Assign (str_size_size) == which)
+ if (1 == tcase.bthrow && Assign (str_size_size) == func.which_)
expected = exceptions [1]; // out_of_range
else if (2 == tcase.bthrow)
expected = exceptions [2]; // length_error
@@ -603,7 +601,7 @@
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case Assign (ptr): {
const String& s_res = s_str.assign (arg_ptr);
res_off = &s_res - &s_str;
@@ -672,7 +670,7 @@
}
// verify that Traits::length was used
- if (Assign (ptr) == which && rg_calls) {
+ if (Assign (ptr) == func.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.compare.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.compare.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.compare.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.compare.cpp Fri May 19 14:16:38 2006
@@ -40,10 +40,8 @@
#define NPOS _RWSTD_SIZE_MAX
#define Compare(which) StringMembers::compare_ ## 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[] = {
@@ -699,7 +697,7 @@
template <class charT, class Traits, class Allocator>
void test_compare (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -718,8 +716,8 @@
// construct the string object to be modified
// and the (possibly unused) argument string
- /* const */ String s_str (wstr, str_len);
- const String s_arg (warg, arg_len);
+ /* const */ String s_str (wstr, str_len);
+ const String s_arg (warg, arg_len);
if (wstr != wstr_buf)
delete[] wstr;
@@ -757,7 +755,8 @@
if (1 == tcase.bthrow)
expected = exceptions [1];
- else if (2 == tcase.bthrow && Compare (size_size_str_size_size) == which)
+ else if ( 2 == tcase.bthrow
+ && Compare (size_size_str_size_size) == func.which_)
expected = exceptions [1];
else if (3 == tcase.bthrow)
expected = exceptions [2];
@@ -770,7 +769,7 @@
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case Compare (ptr): {
res = s_str.compare (arg_ptr);
break;
@@ -811,16 +810,16 @@
}
// verify the returned value
- bool success = res < 0 && tcase.nres == NPOS
- || res > 0 && tcase.nres > 0
- || res == 0 && tcase.nres == 0;
+ const bool success = res < 0 && tcase.nres == NPOS
+ || res > 0 && tcase.nres > 0
+ || res == 0 && tcase.nres == 0;
rw_assert (success, 0, tcase.line,
"line %d. %{$FUNCALL} == %d, got %d",
- __LINE__, tcase.nres != NPOS ? tcase.nres : -1, res);
+ __LINE__, tcase.nres == NPOS ? -1 : int (tcase.nres), res);
// verify that Traits::length was used
- if (Compare (str) == which && rg_calls) {
+ if (Compare (str) == func.which_ && rg_calls) {
rw_assert (n_compare_calls - total_compare_calls > 0,
0, tcase.line, "line %d. %{$FUNCALL} doesn't "
"use traits::compare()", __LINE__);
Modified: incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.cons.cpp Fri May 19 14:16:38 2006
@@ -36,10 +36,8 @@
#define Ctor(which) StringMembers::ctor_ ## which
#define OpSet(which) StringMembers::op_set_ ## 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",
@@ -525,7 +523,7 @@
template <class charT, class Traits, class Allocator>
void test_ctor (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -540,7 +538,7 @@
std::size_t res_len = sizeof wres_buf / sizeof *wres_buf;
charT* wres = rw_expand (wres_buf, tcase.res, tcase.nres, &res_len);
- if (Ctor (range) == which) {
+ if (Ctor (range) == func.which_) {
test_ctor_range (warg, arg_len, res_len,
(Traits*)0, (Allocator*)0, tcase);
@@ -599,7 +597,7 @@
rwt_check_leaks (0, 0);
try {
- switch (which) {
+ switch (func.which_) {
case Ctor (void): {
ret_ptr = new String (Allocator ());
break;
@@ -648,7 +646,7 @@
int (ret_ptr->size ()), ret_ptr->c_str (),
ret_ptr->size ());
- if (Ctor (void) != which) {
+ if (Ctor (void) != func.which_) {
// verify the capacity of the resulting string
rw_assert (ret_ptr->size () <= ret_ptr->capacity (), 0,
tcase.line, "line %d. %{$FUNCALL} expected "
@@ -736,7 +734,7 @@
template <class charT, class Traits, class Allocator>
void test_op_set (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -783,7 +781,7 @@
std::size_t total_length_calls = 0;
std::size_t n_length_calls = 0;
- std::size_t* const rg_calls = OpSet (ptr) == which ?
+ std::size_t* const rg_calls = OpSet (ptr) == func.which_ ?
rw_get_call_counters ((Traits*)0, (charT*)0) : 0;
if (rg_calls)
@@ -823,7 +821,7 @@
rwt_check_leaks (0, 0);
try {
- switch (which) {
+ switch (func.which_) {
case OpSet (ptr): {
str = arg_ptr;
break;
@@ -953,13 +951,13 @@
template <class charT, class Traits, class Allocator>
void test_cons (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
- if (OpSet(ptr) <= which)
- test_op_set (charT (), (Traits*)0, (Allocator*)0, which, tcase);
+ if (OpSet(ptr) <= func.which_)
+ test_op_set (charT (), (Traits*)0, (Allocator*)0, func, tcase);
else
- test_ctor (charT (), (Traits*)0, (Allocator*)0, which, tcase);
+ test_ctor (charT (), (Traits*)0, (Allocator*)0, func, tcase);
}
/**************************************************************************/
Modified: incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.copy.cpp Fri May 19 14:16:38 2006
@@ -40,10 +40,8 @@
#define NPOS _RWSTD_SIZE_MAX
#define Copy(which) StringMembers::copy_ ## 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",
@@ -162,7 +160,7 @@
template <class charT, class Traits, class Allocator>
void test_copy (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -220,7 +218,7 @@
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case Copy (ptr_size): {
res = str.copy (s_res, tcase.size);
break;
Modified: incubator/stdcxx/trunk/tests/strings/21.string.erase.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.erase.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.erase.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.erase.cpp Fri May 19 14:16:38 2006
@@ -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 <string> // for string
@@ -40,10 +40,8 @@
// for convenience and brevity
#define Erase(which) StringMembers::erase_ ## 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",
@@ -64,7 +62,7 @@
// +--------------------------------- controlled sequence
// | +----------------- expected result sequence
// | |
- // V V
+ // V V
TEST ("a", ""),
TEST ("", ""),
@@ -164,7 +162,7 @@
// | | | | | 0 - no exception
// | | | | | 1 - out_of_range
// | | | | |
- // V V V V V
+ // V V V V V
TEST ("", 0, 0, "", 0),
TEST ("\0", 0, 1, "", 0),
TEST ("\0", 0, 0, "\0", 0),
@@ -242,7 +240,7 @@
// | +---------------------- iterator offset
// | | +----------------- expected result sequence
// | | |
- // V V V
+ // V V V
TEST ("a", 0, ""),
TEST ("\0", 0, ""),
@@ -268,9 +266,9 @@
TEST ("ab\0c\0\0", 5, "ab\0c\0"),
TEST ("x@4096y", 4096, "x@4096"),
- TEST ("x@4096", 4088, "x@4095"),
- TEST ("ax@4096", 0, "x@4096"),
- TEST ("x@4096", 9, "x@4095"),
+ TEST ("x@4096", 4088, "x@4095"),
+ TEST ("ax@4096", 0, "x@4096"),
+ TEST ("x@4096", 9, "x@4095"),
TEST ("last test", 4, "lasttest")
};
@@ -280,32 +278,32 @@
template <class charT, class Traits, class Allocator>
void test_erase (charT, Traits*, Allocator*,
- OverloadId which,
- const TestCase &cs)
+ const Function &func,
+ const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
typedef typename String::iterator StringIter;
typedef typename String::const_iterator ConstStringIter;
- const bool use_iters = Erase (iter) <= which;
- if (use_iters && cs.bthrow)
+ const bool use_iters = Erase (iter) <= func.which_;
+ if (use_iters && tcase.bthrow)
return;
static const std::size_t BUFSIZE = 256;
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);
- static char wres_charbuf [BUFSIZE];
- char* res_char = 0;
+ static char nres_buf [BUFSIZE];
+ char* nres = 0;
if (use_iters) {
- std::size_t res_charlen = sizeof wres_charbuf / sizeof *wres_charbuf;
- res_char = rw_expand (wres_charbuf, cs.res, cs.nres, &res_charlen);
+ std::size_t nreslen = sizeof nres_buf / sizeof *nres_buf;
+ nres = rw_expand (nres_buf, tcase.res, tcase.nres, &nreslen);
}
// construct the string object to be modified
@@ -329,9 +327,9 @@
// of the first range into the string object being modified
const std::size_t size1 = str_len;
const std::size_t off1 =
- std::size_t (cs.off) < size1 ? std::size_t (cs.off) : size1;
+ std::size_t (tcase.off) < size1 ? std::size_t (tcase.off) : size1;
const std::size_t ext1 =
- off1 + cs.size < size1 ? cs.size : size1 - off1;
+ off1 + tcase.size < size1 ? tcase.size : size1 - off1;
// create a pair of iterators into the string object being
// modified (used only by the iterator overloads)
@@ -342,14 +340,14 @@
// is some exception expected ?
const char* expected = 0;
- if (1 == cs.bthrow)
+ if (1 == tcase.bthrow)
expected = exceptions [1];
const char* caught = 0;
#else // if defined (_RWSTD_NO_EXCEPTIONS)
- if (cs.bthrow) {
+ if (tcase.bthrow) {
if (wres != wres_buf)
delete[] wres;
@@ -359,20 +357,20 @@
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case Erase (void): {
const String& s_res = s_str.erase ();
res_off = &s_res - &s_str;
break;
}
case Erase (size): {
- const String& s_res = s_str.erase (cs.off);
+ const String& s_res = s_str.erase (tcase.off);
res_off = &s_res - &s_str;
break;
}
case Erase (size_size): {
- const String& s_res = s_str.erase (cs.off, cs.size);
+ const String& s_res = s_str.erase (tcase.off, tcase.size);
res_off = &s_res - &s_str;
break;
}
@@ -394,7 +392,7 @@
// verify the returned value
if (!use_iters) {
- rw_assert (0 == res_off, 0, cs.line,
+ rw_assert (0 == res_off, 0, tcase.line,
"line %d. %{$FUNCALL} returned invalid reference, "
"offset is %zu", __LINE__, res_off);
}
@@ -403,30 +401,30 @@
const ConstStringIter end = s_str.end ();
bool success = begin <= res_iter && res_iter <= end;
- rw_assert (success, 0, cs.line,
+ rw_assert (success, 0, tcase.line,
"line %d. %{$FUNCALL} returned invalid iterator, "
"difference with begin is %td",
__LINE__, res_iter - begin);
- if (std::size_t (cs.off) >= res_len) {
- rw_assert (res_iter == end, 0, cs.line,
+ if (std::size_t (tcase.off) >= res_len) {
+ rw_assert (res_iter == end, 0, tcase.line,
"line %d. %{$FUNCALL} != end()", __LINE__);
}
else {
const std::size_t match =
- rw_match (res_char + cs.off, &(*res_iter), 1);
- rw_assert (1 == match, 0, cs.line,
- "line %d. %{$FUNCALL} == %{#c}, got %{#c}",
- __LINE__, res_char[cs.off], *res_iter);
- }
+ rw_match (nres + tcase.off, &(*res_iter), 1);
+ rw_assert (1 == match, 0, tcase.line,
+ "line %d. %{$FUNCALL} == %{#c}, got %{#c}",
+ __LINE__, nres[tcase.off], *res_iter);
+ }
}
// verfiy that strings length are equal
- rw_assert (res_len == s_str.size (), 0, cs.line,
+ rw_assert (res_len == s_str.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_str.size ()), s_str.c_str (), s_str.size ());
if (res_len == s_str.size ()) {
@@ -434,12 +432,12 @@
// (and only then), also verify that the modified
// string matches the expected result
const std::size_t match =
- rw_match (cs.res, s_str.c_str(), cs.nres);
+ rw_match (tcase.res, s_str.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_str.size ()),
s_str.c_str (), match);
}
@@ -449,21 +447,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);
@@ -475,11 +473,11 @@
// 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 (s_str),
- __LINE__, cs.line, caught);
+ __LINE__, tcase.line, caught);
}
- if (res_char != wres_charbuf)
- delete[] res_char;
+ if (nres != nres_buf)
+ delete[] nres;
if (wres != wres_buf)
delete[] wres;
Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.find.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.cpp Fri May 19 14:16:38 2006
@@ -40,10 +40,8 @@
#define NPOS _RWSTD_SIZE_MAX
#define Find(which) StringMembers::find_ ## 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",
@@ -641,7 +639,7 @@
template <class charT, class Traits, class Allocator>
void test_find (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -699,7 +697,7 @@
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case Find (ptr): {
res = s_str.find (arg_ptr);
break;
Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.first.not.of.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.find.first.not.of.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.first.not.of.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.first.not.of.cpp Fri May 19 14:16:38 2006
@@ -41,10 +41,8 @@
#define NPOS _RWSTD_SIZE_MAX
#define FindFirstNotOf(which) StringMembers::find_first_not_of_ ## 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",
@@ -610,8 +608,8 @@
template <class charT, class Traits, class Allocator>
void test_find_first_not_of (charT, Traits*, Allocator*,
- OverloadId which,
- const TestCase &cs)
+ const Function &func,
+ const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -623,8 +621,8 @@
std::size_t str_len = sizeof wstr_buf / sizeof *wstr_buf;
std::size_t arg_len = sizeof warg_buf / sizeof *warg_buf;
- charT* wstr = rw_expand (wstr_buf, cs.str, cs.str_len, &str_len);
- charT* warg = rw_expand (warg_buf, cs.arg, cs.arg_len, &arg_len);
+ charT* wstr = rw_expand (wstr_buf, tcase.str, tcase.str_len, &str_len);
+ charT* warg = rw_expand (warg_buf, tcase.arg, tcase.arg_len, &arg_len);
// construct the string object and the argument string
const String s_str (wstr, str_len);
@@ -645,32 +643,32 @@
const StringState str_state (rw_get_string_state (s_str));
std::size_t res = 0;
- std::size_t exp_res = NPOS != cs.nres ? cs.nres : String::npos;
+ std::size_t exp_res = NPOS != tcase.nres ? tcase.nres : String::npos;
- const charT* const arg_ptr = cs.arg ? s_arg.c_str () : s_str.c_str ();
- const String& arg_str = cs.arg ? s_arg : s_str;
- const charT arg_val = make_char (char (cs.val), (charT*)0);
+ const charT* const arg_ptr = tcase.arg ? s_arg.c_str () : s_str.c_str ();
+ const String& arg_str = tcase.arg ? s_arg : s_str;
+ const charT arg_val = make_char (char (tcase.val), (charT*)0);
- std::size_t size = cs.size >= 0 ? cs.size : s_arg.max_size () + 1;
+ std::size_t size = tcase.size >= 0 ? tcase.size : s_arg.max_size () + 1;
#ifndef _RWSTD_NO_EXCEPTIONS
// is some exception expected ?
const char* expected = 0;
- if (1 == cs.bthrow)
+ if (1 == tcase.bthrow)
expected = exceptions [2];
const char* caught = 0;
#else // if defined (_RWSTD_NO_EXCEPTIONS)
- if (cs.bthrow)
+ if (tcase.bthrow)
return;
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case FindFirstNotOf (ptr): {
res = s_str.find_first_not_of (arg_ptr);
break;
@@ -682,17 +680,17 @@
}
case FindFirstNotOf (ptr_size): {
- res = s_str.find_first_not_of (arg_ptr, cs.off);
+ res = s_str.find_first_not_of (arg_ptr, tcase.off);
break;
}
case FindFirstNotOf (ptr_size_size): {
- res = s_str.find_first_not_of (arg_ptr, cs.off, size);
+ res = s_str.find_first_not_of (arg_ptr, tcase.off, size);
break;
}
case FindFirstNotOf (str_size): {
- res = s_str.find_first_not_of (arg_str, cs.off);
+ res = s_str.find_first_not_of (arg_str, tcase.off);
break;
}
@@ -702,7 +700,7 @@
}
case FindFirstNotOf (val_size): {
- res = s_str.find_first_not_of (arg_val, cs.off);
+ res = s_str.find_first_not_of (arg_val, tcase.off);
break;
}
@@ -712,10 +710,10 @@
}
// verify the returned value
- rw_assert (exp_res == res, 0, cs.line,
+ rw_assert (exp_res == res, 0, tcase.line,
"line %d. %{$FUNCALL} == %{?}%zu%{;}%{?}npos%{;}, "
"got %{?}%zu%{;}%{?}npos%{;}",
- __LINE__, NPOS != cs.nres, exp_res, NPOS == cs.nres,
+ __LINE__, NPOS != tcase.nres, exp_res, NPOS == tcase.nres,
String::npos != res, res, String::npos == res);
}
@@ -723,21 +721,21 @@
catch (const std::length_error &ex) {
caught = exceptions [2];
- 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);
@@ -749,10 +747,10 @@
// 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 (s_str),
- __LINE__, cs.line, caught);
+ __LINE__, tcase.line, caught);
}
- else if (-1 != cs.bthrow) {
- rw_assert (caught == expected, 0, cs.line,
+ 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);
Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.first.of.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.find.first.of.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.first.of.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.first.of.cpp Fri May 19 14:16:38 2006
@@ -41,10 +41,8 @@
#define NPOS _RWSTD_SIZE_MAX
#define FindFirstOf(which) StringMembers::find_first_of_ ## 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",
@@ -620,8 +618,8 @@
template <class charT, class Traits, class Allocator>
void test_find_first_of (charT, Traits*, Allocator*,
- OverloadId which,
- const TestCase &cs)
+ const Function &func,
+ const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -633,8 +631,8 @@
std::size_t str_len = sizeof wstr_buf / sizeof *wstr_buf;
std::size_t arg_len = sizeof warg_buf / sizeof *warg_buf;
- charT* wstr = rw_expand (wstr_buf, cs.str, cs.str_len, &str_len);
- charT* warg = rw_expand (warg_buf, cs.arg, cs.arg_len, &arg_len);
+ charT* wstr = rw_expand (wstr_buf, tcase.str, tcase.str_len, &str_len);
+ charT* warg = rw_expand (warg_buf, tcase.arg, tcase.arg_len, &arg_len);
// construct the string object and the argument string
const String s_str (wstr, str_len);
@@ -655,32 +653,32 @@
const StringState str_state (rw_get_string_state (s_str));
std::size_t res = 0;
- std::size_t exp_res = NPOS != cs.nres ? cs.nres : String::npos;
+ std::size_t exp_res = NPOS != tcase.nres ? tcase.nres : String::npos;
- const charT* const arg_ptr = cs.arg ? s_arg.c_str () : s_str.c_str ();
- const String& arg_str = cs.arg ? s_arg : s_str;
- const charT arg_val = make_char (char (cs.val), (charT*)0);
+ const charT* const arg_ptr = tcase.arg ? s_arg.c_str () : s_str.c_str ();
+ const String& arg_str = tcase.arg ? s_arg : s_str;
+ const charT arg_val = make_char (char (tcase.val), (charT*)0);
- std::size_t size = cs.size >= 0 ? cs.size : s_arg.max_size () + 1;
+ std::size_t size = tcase.size >= 0 ? tcase.size : s_arg.max_size () + 1;
#ifndef _RWSTD_NO_EXCEPTIONS
// is some exception expected ?
const char* expected = 0;
- if (1 == cs.bthrow)
+ if (1 == tcase.bthrow)
expected = exceptions [2];
const char* caught = 0;
#else // if defined (_RWSTD_NO_EXCEPTIONS)
- if (cs.bthrow)
+ if (tcase.bthrow)
return;
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case FindFirstOf (ptr): {
res = s_str.find_first_of (arg_ptr);
break;
@@ -692,17 +690,17 @@
}
case FindFirstOf (ptr_size): {
- res = s_str.find_first_of (arg_ptr, cs.off);
+ res = s_str.find_first_of (arg_ptr, tcase.off);
break;
}
case FindFirstOf (ptr_size_size): {
- res = s_str.find_first_of (arg_ptr, cs.off, size);
+ res = s_str.find_first_of (arg_ptr, tcase.off, size);
break;
}
case FindFirstOf (str_size): {
- res = s_str.find_first_of (arg_str, cs.off);
+ res = s_str.find_first_of (arg_str, tcase.off);
break;
}
@@ -712,7 +710,7 @@
}
case FindFirstOf (val_size): {
- res = s_str.find_first_of (arg_val, cs.off);
+ res = s_str.find_first_of (arg_val, tcase.off);
break;
}
@@ -722,10 +720,10 @@
}
// verify the returned value
- rw_assert (exp_res == res, 0, cs.line,
+ rw_assert (exp_res == res, 0, tcase.line,
"line %d. %{$FUNCALL} == %{?}%zu%{;}%{?}npos%{;}, "
"got %{?}%zu%{;}%{?}npos%{;}",
- __LINE__, NPOS != cs.nres, exp_res, NPOS == cs.nres,
+ __LINE__, NPOS != tcase.nres, exp_res, NPOS == tcase.nres,
String::npos != res, res, String::npos == res);
}
@@ -733,21 +731,21 @@
catch (const std::length_error &ex) {
caught = exceptions [2];
- 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);
@@ -759,10 +757,10 @@
// 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 (s_str),
- __LINE__, cs.line, caught);
+ __LINE__, tcase.line, caught);
}
- else if (-1 != cs.bthrow) {
- rw_assert (caught == expected, 0, cs.line,
+ 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);
@@ -800,4 +798,3 @@
"lib.string.find.first.of",
test_find_first_of, tests, test_count);
}
-
Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.last.not.of.cpp Fri May 19 14:16:38 2006
@@ -41,10 +41,8 @@
#define NPOS _RWSTD_SIZE_MAX
#define FindLastNotOf(which) StringMembers::find_last_not_of_ ## 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",
@@ -622,8 +620,8 @@
template <class charT, class Traits, class Allocator>
void test_find_last_not_of (charT, Traits*, Allocator*,
- OverloadId which,
- const TestCase &cs)
+ const Function &func,
+ const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -635,8 +633,8 @@
std::size_t str_len = sizeof wstr_buf / sizeof *wstr_buf;
std::size_t arg_len = sizeof warg_buf / sizeof *warg_buf;
- charT* wstr = rw_expand (wstr_buf, cs.str, cs.str_len, &str_len);
- charT* warg = rw_expand (warg_buf, cs.arg, cs.arg_len, &arg_len);
+ charT* wstr = rw_expand (wstr_buf, tcase.str, tcase.str_len, &str_len);
+ charT* warg = rw_expand (warg_buf, tcase.arg, tcase.arg_len, &arg_len);
// construct the string object and the argument string
const String s_str (wstr, str_len);
@@ -657,32 +655,32 @@
const StringState str_state (rw_get_string_state (s_str));
std::size_t res = 0;
- std::size_t exp_res = NPOS != cs.nres ? cs.nres : String::npos;
+ std::size_t exp_res = NPOS != tcase.nres ? tcase.nres : String::npos;
- const charT* const arg_ptr = cs.arg ? s_arg.c_str () : s_str.c_str ();
- const String& arg_str = cs.arg ? s_arg : s_str;
- const charT arg_val = make_char (char (cs.val), (charT*)0);
+ const charT* const arg_ptr = tcase.arg ? s_arg.c_str () : s_str.c_str ();
+ const String& arg_str = tcase.arg ? s_arg : s_str;
+ const charT arg_val = make_char (char (tcase.val), (charT*)0);
- std::size_t size = cs.size >= 0 ? cs.size : s_arg.max_size () + 1;
+ std::size_t size = tcase.size >= 0 ? tcase.size : s_arg.max_size () + 1;
#ifndef _RWSTD_NO_EXCEPTIONS
// is some exception expected ?
const char* expected = 0;
- if (1 == cs.bthrow)
+ if (1 == tcase.bthrow)
expected = exceptions [2];
const char* caught = 0;
#else // if defined (_RWSTD_NO_EXCEPTIONS)
- if (cs.bthrow)
+ if (tcase.bthrow)
return;
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case FindLastNotOf (ptr): {
res = s_str.find_last_not_of (arg_ptr);
break;
@@ -694,17 +692,17 @@
}
case FindLastNotOf (ptr_size): {
- res = s_str.find_last_not_of (arg_ptr, cs.off);
+ res = s_str.find_last_not_of (arg_ptr, tcase.off);
break;
}
case FindLastNotOf (ptr_size_size): {
- res = s_str.find_last_not_of (arg_ptr, cs.off, size);
+ res = s_str.find_last_not_of (arg_ptr, tcase.off, size);
break;
}
case FindLastNotOf (str_size): {
- res = s_str.find_last_not_of (arg_str, cs.off);
+ res = s_str.find_last_not_of (arg_str, tcase.off);
break;
}
@@ -714,7 +712,7 @@
}
case FindLastNotOf (val_size): {
- res = s_str.find_last_not_of (arg_val, cs.off);
+ res = s_str.find_last_not_of (arg_val, tcase.off);
break;
}
@@ -724,10 +722,10 @@
}
// verify the returned value
- rw_assert (exp_res == res, 0, cs.line,
+ rw_assert (exp_res == res, 0, tcase.line,
"line %d. %{$FUNCALL} == %{?}%zu%{;}%{?}npos%{;}, "
"got %{?}%zu%{;}%{?}npos%{;}",
- __LINE__, NPOS != cs.nres, exp_res, NPOS == cs.nres,
+ __LINE__, NPOS != tcase.nres, exp_res, NPOS == tcase.nres,
String::npos != res, res, String::npos == res);
}
@@ -735,21 +733,21 @@
catch (const std::length_error &ex) {
caught = exceptions [2];
- 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);
@@ -761,10 +759,10 @@
// 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 (s_str),
- __LINE__, cs.line, caught);
+ __LINE__, tcase.line, caught);
}
- else if (-1 != cs.bthrow) {
- rw_assert (caught == expected, 0, cs.line,
+ 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);
Modified: incubator/stdcxx/trunk/tests/strings/21.string.find.last.of.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.find.last.of.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.find.last.of.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.find.last.of.cpp Fri May 19 14:16:38 2006
@@ -1,7 +1,6 @@
/***************************************************************************
*
- * 21.string.find.last.of.cpp -
- * string test exercising lib.string.find.last.of
+ * 21.string.find.last.of.cpp - test exercising lib.string.find.last.of
*
* $Id$
*
@@ -41,10 +40,8 @@
#define NPOS _RWSTD_SIZE_MAX
#define FindLastOf(which) StringMembers::find_last_of_ ## 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",
@@ -636,8 +633,8 @@
template <class charT, class Traits, class Allocator>
void test_find_last_of (charT, Traits*, Allocator*,
- OverloadId which,
- const TestCase &cs)
+ const Function &func,
+ const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -649,8 +646,8 @@
std::size_t str_len = sizeof wstr_buf / sizeof *wstr_buf;
std::size_t arg_len = sizeof warg_buf / sizeof *warg_buf;
- charT* wstr = rw_expand (wstr_buf, cs.str, cs.str_len, &str_len);
- charT* warg = rw_expand (warg_buf, cs.arg, cs.arg_len, &arg_len);
+ charT* wstr = rw_expand (wstr_buf, tcase.str, tcase.str_len, &str_len);
+ charT* warg = rw_expand (warg_buf, tcase.arg, tcase.arg_len, &arg_len);
// construct the string object and the argument string
const String s_str (wstr, str_len);
@@ -671,32 +668,32 @@
const StringState str_state (rw_get_string_state (s_str));
std::size_t res = 0;
- std::size_t exp_res = NPOS != cs.nres ? cs.nres : String::npos;
+ std::size_t exp_res = NPOS != tcase.nres ? tcase.nres : String::npos;
- const charT* const arg_ptr = cs.arg ? s_arg.c_str () : s_str.c_str ();
- const String& arg_str = cs.arg ? s_arg : s_str;
- const charT arg_val = make_char (char (cs.val), (charT*)0);
+ const charT* const arg_ptr = tcase.arg ? s_arg.c_str () : s_str.c_str ();
+ const String& arg_str = tcase.arg ? s_arg : s_str;
+ const charT arg_val = make_char (char (tcase.val), (charT*)0);
- std::size_t size = cs.size >= 0 ? cs.size : s_arg.max_size () + 1;
+ std::size_t size = tcase.size >= 0 ? tcase.size : s_arg.max_size () + 1;
#ifndef _RWSTD_NO_EXCEPTIONS
// is some exception expected ?
const char* expected = 0;
- if (1 == cs.bthrow)
+ if (1 == tcase.bthrow)
expected = exceptions [2];
const char* caught = 0;
#else // if defined (_RWSTD_NO_EXCEPTIONS)
- if (cs.bthrow)
+ if (tcase.bthrow)
return;
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case FindLastOf (ptr): {
res = s_str.find_last_of (arg_ptr);
break;
@@ -708,17 +705,17 @@
}
case FindLastOf (ptr_size): {
- res = s_str.find_last_of (arg_ptr, cs.off);
+ res = s_str.find_last_of (arg_ptr, tcase.off);
break;
}
case FindLastOf (ptr_size_size): {
- res = s_str.find_last_of (arg_ptr, cs.off, size);
+ res = s_str.find_last_of (arg_ptr, tcase.off, size);
break;
}
case FindLastOf (str_size): {
- res = s_str.find_last_of (arg_str, cs.off);
+ res = s_str.find_last_of (arg_str, tcase.off);
break;
}
@@ -728,7 +725,7 @@
}
case FindLastOf (val_size): {
- res = s_str.find_last_of (arg_val, cs.off);
+ res = s_str.find_last_of (arg_val, tcase.off);
break;
}
@@ -738,10 +735,10 @@
}
// verify the returned value
- rw_assert (exp_res == res, 0, cs.line,
+ rw_assert (exp_res == res, 0, tcase.line,
"line %d. %{$FUNCALL} == %{?}%zu%{;}%{?}npos%{;}, "
"got %{?}%zu%{;}%{?}npos%{;}",
- __LINE__, NPOS != cs.nres, exp_res, NPOS == cs.nres,
+ __LINE__, NPOS != tcase.nres, exp_res, NPOS == tcase.nres,
String::npos != res, res, String::npos == res);
}
@@ -749,21 +746,21 @@
catch (const std::length_error &ex) {
caught = exceptions [2];
- 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);
@@ -775,10 +772,10 @@
// 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 (s_str),
- __LINE__, cs.line, caught);
+ __LINE__, tcase.line, caught);
}
- else if (-1 != cs.bthrow) {
- rw_assert (caught == expected, 0, cs.line,
+ 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);
@@ -816,4 +813,3 @@
"lib.string.find.last.of",
test_find_last_of, tests, test_count);
}
-
Modified: incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.insert.cpp Fri May 19 14:16:38 2006
@@ -41,10 +41,8 @@
// for convenience and brevity
#define Insert(which) StringMembers::insert_ ## 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",
@@ -604,7 +602,7 @@
template <class charT, class Traits, class Allocator>
void test_insert (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -627,7 +625,7 @@
charT* wres = rw_expand (wres_buf, tcase.res, tcase.nres, &res_len);
// special processing for insert_range to exercise all iterators
- if (Insert (range) == which) {
+ if (Insert (range) == func.which_) {
test_insert_range (wstr, str_len, warg, arg_len,
res_len, (Traits*)0, (Allocator*)0, tcase);
if (wstr != wstr_buf)
@@ -660,7 +658,7 @@
const StringState str_state (rw_get_string_state (s_str));
std::size_t res_off = 0;
- std::size_t exp_off = Insert (val) == which ? tcase.off : 0;
+ std::size_t exp_off = Insert (val) == func.which_ ? tcase.off : 0;
// compute the offset and the extent (the number of elements)
// of the first range into the string object being modified
@@ -693,11 +691,12 @@
#ifndef _RWSTD_NO_EXCEPTIONS
- const bool use_iters = (Insert (val) <= which);
+ const bool use_iters = (Insert (val) <= func.which_);
if (1 == tcase.bthrow && !use_iters)
expected = exceptions [1]; // out_of_range
- else if (2 == tcase.bthrow && Insert (size_str_size_size) == which)
+ else if ( 2 == tcase.bthrow
+ && Insert (size_str_size_size) == func.which_)
expected = exceptions [1]; // out_of_range
else if (3 == tcase.bthrow && !use_iters)
expected = exceptions [2]; // length_error
@@ -718,7 +717,7 @@
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case Insert (size_ptr): {
const String& s_res = s_str.insert (tcase.off, arg_ptr);
res_off = &s_res - &s_str;
@@ -776,8 +775,8 @@
rw_assert (exp_off == res_off, 0, tcase.line,
"line %d. %{$FUNCALL} %{?}== %zu, got %zu%{;}"
"%{?}returned invalid reference, offset is %zu%{;}",
- __LINE__, Insert (val) == which, exp_off, res_off,
- Insert (val) != which, res_off);
+ __LINE__, Insert (val) == func.which_, exp_off, res_off,
+ Insert (val) != func.which_, res_off);
// verfiy that strings length are equal
rw_assert (res_len == s_str.size (), 0, tcase.line,
@@ -803,7 +802,7 @@
}
// verify that Traits::length was used
- if (Insert (size_ptr) == which && rg_calls) {
+ if (Insert (size_ptr) == func.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/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.op.plus.equal.cpp?rev=407913&r1=407912&r2=407913&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 Fri May 19 14:16:38 2006
@@ -42,10 +42,8 @@
// for convenience and brevity
#define OpPlusEq(which) StringMembers::op_plus_eq_ ## 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",
@@ -219,7 +217,7 @@
template <class charT, class Traits, class Allocator>
void test_op_plus_eq (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -306,7 +304,7 @@
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case OpPlusEq (ptr): {
const String& s_res = s_str += arg_ptr;
res_off = &s_res - &s_str;
@@ -361,7 +359,7 @@
}
// verify that Traits::length was used
- if (OpPlusEq (ptr) == which && rg_calls) {
+ if (OpPlusEq (ptr) == func.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/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.replace.cpp Fri May 19 14:16:38 2006
@@ -42,8 +42,8 @@
// for convenience and brevity
#define Replace(which) StringMembers::replace_ ## which
-typedef StringMembers::OverloadId OverloadId;
-typedef StringMembers::TestCase TestCase;
+typedef StringMembers::Function Function;
+typedef StringMembers::TestCase TestCase;
static const char* const exceptions[] = {
"unknown exception", "out_of_range", "length_error",
@@ -781,7 +781,7 @@
template <class charT, class Traits, class Allocator>
void test_replace (charT, Traits*, Allocator*,
- OverloadId which,
+ const Function &func,
const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -805,7 +805,7 @@
charT* warg = rw_expand (warg_buf, tcase.arg, tcase.arg_len, &arg_len);
charT* wres = rw_expand (wres_buf, tcase.res, tcase.nres, &res_len);
- if (Replace (iter_iter_range) == which) {
+ if (Replace (iter_iter_range) == func.which_) {
// special processing for the replace() template member
// function to exercise all iterator categories
test_replace_range (wstr, str_len, warg, arg_len,
@@ -871,7 +871,8 @@
// or 0 when no such counter exists (i.e., when Traits is not
// UserTraits)
std::size_t* length_calls =
- Replace (size_size_ptr) == which || Replace (iter_iter_ptr) == which ?
+ Replace (size_size_ptr) == func.which_
+ || Replace (iter_iter_ptr) == func.which_ ?
rw_get_call_counters ((Traits*)0, (charT*)0) : 0;
if (length_calls) {
@@ -885,7 +886,7 @@
// out_of_range is only generated from size_type overloads
// of replace() and not from the iterator equivalents of
// the same functions
- const bool use_iters = Replace (iter_iter_ptr) <= which;
+ const bool use_iters = Replace (iter_iter_ptr) <= func.which_;
// pointer to the returned reference
const String* ret_ptr = 0;
@@ -936,7 +937,7 @@
rw_check_leaks (str.get_allocator ());
try {
- switch (which) {
+ switch (func.which_) {
case Replace (size_size_ptr):
ret_ptr = &str.replace (arg_off, arg_size, arg_ptr);
break;
Modified: incubator/stdcxx/trunk/tests/strings/21.string.rfind.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.string.rfind.cpp?rev=407913&r1=407912&r2=407913&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.string.rfind.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.string.rfind.cpp Fri May 19 14:16:38 2006
@@ -40,10 +40,8 @@
#define NPOS _RWSTD_SIZE_MAX
#define RFind(which) StringMembers::rfind_ ## 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",
@@ -624,8 +622,8 @@
template <class charT, class Traits, class Allocator>
void test_rfind (charT, Traits*, Allocator*,
- OverloadId which,
- const TestCase &cs)
+ const Function &func,
+ const TestCase &tcase)
{
typedef std::basic_string <charT, Traits, Allocator> String;
@@ -637,8 +635,8 @@
std::size_t str_len = sizeof wstr_buf / sizeof *wstr_buf;
std::size_t arg_len = sizeof warg_buf / sizeof *warg_buf;
- charT* wstr = rw_expand (wstr_buf, cs.str, cs.str_len, &str_len);
- charT* warg = rw_expand (warg_buf, cs.arg, cs.arg_len, &arg_len);
+ charT* wstr = rw_expand (wstr_buf, tcase.str, tcase.str_len, &str_len);
+ charT* warg = rw_expand (warg_buf, tcase.arg, tcase.arg_len, &arg_len);
// construct the string object and the argument string
const String s_str (wstr, str_len);
@@ -659,32 +657,32 @@
const StringState str_state (rw_get_string_state (s_str));
std::size_t res = 0;
- std::size_t exp_res = NPOS != cs.nres ? cs.nres : String::npos;
+ std::size_t exp_res = NPOS != tcase.nres ? tcase.nres : String::npos;
- const charT* const arg_ptr = cs.arg ? s_arg.c_str () : s_str.c_str ();
- const String& arg_str = cs.arg ? s_arg : s_str;
- const charT arg_val = make_char (char (cs.val), (charT*)0);
+ const charT* const arg_ptr = tcase.arg ? s_arg.c_str () : s_str.c_str ();
+ const String& arg_str = tcase.arg ? s_arg : s_str;
+ const charT arg_val = make_char (char (tcase.val), (charT*)0);
- std::size_t size = cs.size >= 0 ? cs.size : s_arg.max_size () + 1;
+ std::size_t size = tcase.size >= 0 ? tcase.size : s_arg.max_size () + 1;
#ifndef _RWSTD_NO_EXCEPTIONS
// is some exception expected ?
const char* expected = 0;
- if (1 == cs.bthrow)
+ if (1 == tcase.bthrow)
expected = exceptions [2];
const char* caught = 0;
#else // if defined (_RWSTD_NO_EXCEPTIONS)
- if (cs.bthrow)
+ if (tcase.bthrow)
return;
#endif // _RWSTD_NO_EXCEPTIONS
try {
- switch (which) {
+ switch (func.which_) {
case RFind (ptr): {
res = s_str.rfind (arg_ptr);
break;
@@ -696,17 +694,17 @@
}
case RFind (ptr_size): {
- res = s_str.rfind (arg_ptr, cs.off);
+ res = s_str.rfind (arg_ptr, tcase.off);
break;
}
case RFind (ptr_size_size): {
- res = s_str.rfind (arg_ptr, cs.off, size);
+ res = s_str.rfind (arg_ptr, tcase.off, size);
break;
}
case RFind (str_size): {
- res = s_str.rfind (arg_str, cs.off);
+ res = s_str.rfind (arg_str, tcase.off);
break;
}
@@ -716,7 +714,7 @@
}
case RFind (val_size): {
- res = s_str.rfind (arg_val, cs.off);
+ res = s_str.rfind (arg_val, tcase.off);
break;
}
@@ -726,10 +724,10 @@
}
// verify the returned value
- rw_assert (exp_res == res, 0, cs.line,
+ rw_assert (exp_res == res, 0, tcase.line,
"line %d. %{$FUNCALL} == %{?}%zu%{;}%{?}npos%{;}, "
"got %{?}%zu%{;}%{?}npos%{;}",
- __LINE__, NPOS != cs.nres, exp_res, NPOS == cs.nres,
+ __LINE__, NPOS != tcase.nres, exp_res, NPOS == tcase.nres,
String::npos != res, res, String::npos == res);
}
@@ -737,21 +735,21 @@
catch (const std::length_error &ex) {
caught = exceptions [2];
- 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);
@@ -763,10 +761,10 @@
// 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 (s_str),
- __LINE__, cs.line, caught);
+ __LINE__, tcase.line, caught);
}
- else if (-1 != cs.bthrow) {
- rw_assert (caught == expected, 0, cs.line,
+ 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);