summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/testsuite/21_strings/replace.cc
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-26 18:21:32 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2002-04-26 18:21:32 +0000
commit88e95bad22ca6b72560f58f06fe3ef36ee2e327f (patch)
treeba9d0378036212ae276aceb1413198a4370acc43 /libstdc++-v3/testsuite/21_strings/replace.cc
parent5e277a8cc2e47a99392e3e77689d8d7b538c7d09 (diff)
downloadppe42-gcc-88e95bad22ca6b72560f58f06fe3ef36ee2e327f.tar.gz
ppe42-gcc-88e95bad22ca6b72560f58f06fe3ef36ee2e327f.zip
2002-04-26 Paolo Carlini <pcarlini@unitus.it>
* include/bits/basic_string.h (replace(__pos, __n1, __s, __n2): Fix and tighten __throw_length_error check. * testsuite/21_strings/replace.cc (test05): New. * testsuite/21_strings/replace.cc (test02, test03, test04): Tweak. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52797 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/21_strings/replace.cc')
-rw-r--r--libstdc++-v3/testsuite/21_strings/replace.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/21_strings/replace.cc b/libstdc++-v3/testsuite/21_strings/replace.cc
index 1b3cc3162f2..6dc9ec6b9bf 100644
--- a/libstdc++-v3/testsuite/21_strings/replace.cc
+++ b/libstdc++-v3/testsuite/21_strings/replace.cc
@@ -84,6 +84,7 @@ bool test01(void)
void
test02()
{
+ bool test = true;
const char* strlit = "../the long pier/Hanalei Bay/Kauai/Hawaii";
std::string aux = strlit;
aux.replace(aux.begin()+5, aux.begin()+20,
@@ -100,6 +101,7 @@ test02()
void
test03()
{
+ bool test = true;
const char* title01 = "nine types of ambiguity";
const char* title02 = "ultra";
std::string str01 = title01;
@@ -145,6 +147,7 @@ test03()
void
test04()
{
+ bool test = true;
std::string str01 = "geogaddi";
std::string str02;
@@ -175,11 +178,25 @@ test04()
VERIFY(str02 == "geogaddi");
}
+// We wrongly used __n1 instead of __foldn1 in the length_error
+// check at the beginning of replace(__pos, __n1, __s, __n2)
+void
+test05()
+{
+ bool test = true;
+ std::string str01 = "londinium";
+ std::string str02 = "cydonia";
+
+ str01.replace(0, 20, str02.c_str(), 3);
+ VERIFY(str01 == "cyd");
+}
+
int main()
{
test01();
test02();
test03();
test04();
+ test05();
return 0;
}
OpenPOWER on IntegriCloud