[multiple changes]

2000-06-13  Brent Verner <brent@rcfile.org>

	* bits/string.tcc (string::rfind): Fix.
	* testsuite/21_strings/rfind.cc: New file.

2000-06-26  Anthony Williams  <anthony@anthonyw.cjb.net>

	* testsuite/21_strings/ctor_copy_dtor.cc: Fixed logic error.

2000-06-26  Branko Cibej  <branko.cibej@hermes.si>

        * testsuite/27_io/filebuf_members.cc (test_01): Fixed typos.

        * mkcheck.in: Make the *.txt and *.tst files writable after
	  copying them to $TEST_DIR.

        * testsuite/27_io/ostream_inserter_arith.cc: Renamed
          __TEST_NUMPUT_VERBOSE to TEST_NUMPUT_VERBOSE.
        Define TEST_NUMPUT_VERBOSE only if DEBUG_ASSERT.

From-SVN: r34719
This commit is contained in:
Benjamin Kosnik 2000-06-26 20:22:01 +00:00
parent 913c27bf98
commit 644638bc02
5 changed files with 42 additions and 23 deletions

View File

@ -1,8 +1,23 @@
2000-06-13 Brent Verner <brent@rcfile.org>
* bits/string.tcc (string::rfind): Fix.
* testsuite/21_strings/rfind.cc: New file.
2000-06-26 Anthony Williams <anthony@anthonyw.cjb.net>
* testsuite/21_strings/ctor_copy_dtor.cc: Fixed logic error.
2000-06-26 Branko Cibej <branko.cibej@hermes.si>
* mkcheck.in: Make the *.txt and *.tst files writable
after copying them to $TEST_DIR.
* testsuite/27_io/filebuf_members.cc (test_01): Fixed typos.
* mkcheck.in: Make the *.txt and *.tst files writable after
copying them to $TEST_DIR.
* testsuite/27_io/ostream_inserter_arith.cc: Renamed
__TEST_NUMPUT_VERBOSE to TEST_NUMPUT_VERBOSE.
Define TEST_NUMPUT_VERBOSE only if DEBUG_ASSERT.
2000-06-23 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
* bits/fstream.tcc (basic_filebuf::basic_filebuf(fd)): Use it.

View File

@ -634,14 +634,14 @@ namespace std
size_type __size = this->size();
if (__n <= __size)
{
size_t __xpos = __size - __n;
if (__xpos > __pos)
__xpos = __pos;
for (++__xpos; __xpos-- > 0; )
if (traits_type::eq(_M_data()[__xpos], *__s)
&& traits_type::compare(_M_data() + __xpos, __s, __n) == 0)
return __xpos;
__pos = std::min(__size - __n ,__pos);
const _CharT* __data = _M_data();
do
{
if (traits_type::compare(__data + __pos, __s, __n) == 0)
return __pos;
}
while (__pos-- > 0);
}
return npos;
}

View File

@ -1,6 +1,6 @@
// 1999-06-04 bkoz
// Copyright (C) 1999 Free Software Foundation, Inc.
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
@ -79,8 +79,9 @@ int test01(void)
// NB: As strlen(str_lit01) != csz01, this test is undefined. It
// should not crash, but what gets constructed is a bit arbitrary.
// The "maverick's" of all string objects.
try {
std::string str04(str_lit01, npos); // the "maverick's" of all string objects.
std::string str04(str_lit01, npos);
test &= true;
}
catch(std::length_error& fail) {
@ -90,9 +91,10 @@ int test01(void)
test &= false;
}
// Build a maxsize-1 lengthed string consisting of all A's
try {
std::string str03(str_lit01, csz01 - 1);
test &= str03.size() != 0;
std::string str03(csz01 - 1, 'A');
test &= str03.size() == csz01 - 1;
test &= str03.size() <= str03.capacity();
}
// NB: bad_alloc is regrettable but entirely kosher for

View File

@ -47,7 +47,7 @@ test_01()
int close_num;
// read (ext)
int fd = open(name01, O_RDONLY);
int fd = open(name_01, O_RDONLY);
test &= fd >= 0;
{
@ -59,11 +59,11 @@ test_01()
// read (standard)
FILE* f = fopen(name01, "r");
FILE* f = fopen(name_01, "r");
test &= !f;
{
std::ifstream ifstream1(name02);
std::ifstream ifstream1(name_01);
test &= ifstream1.is_open();
std::ios_base::iostate st01 = ifstream1.rdstate();
test &= st01 == std::ios_base::goodbit;

View File

@ -28,7 +28,9 @@
using namespace std;
#define __TEST_NUMPUT_VERBOSE 1
#ifndef DEBUG_ASSERT
# define TEST_NUMPUT_VERBOSE 1
#endif
struct _TestCase
{
@ -190,7 +192,7 @@ void test01()
for (int j=0; j<sizeof(testcases)/sizeof(testcases[0]); j++)
{
_TestCase & tc = testcases[j];
#ifdef __TEST_NUMPUT_VERBOSE
#ifdef TEST_NUMPUT_VERBOSE
cout << "expect: " << tc.result << endl;
#endif
// test double with char type
@ -201,7 +203,7 @@ void test01()
os.imbue(__loc);
apply_formatting(tc, os);
os << tc.val;
#ifdef __TEST_NUMPUT_VERBOSE
#ifdef TEST_NUMPUT_VERBOSE
cout << "result: " << os.str() << endl;
#endif
assert(os && os.str() == tc.result);
@ -214,7 +216,7 @@ void test01()
os.imbue(__loc);
apply_formatting(tc, os);
os << (long double)tc.val;
#ifdef __TEST_NUMPUT_VERBOSE
#ifdef TEST_NUMPUT_VERBOSE
cout << "result: " << os.str() << endl;
#endif
assert(os && os.str() == tc.result);
@ -257,7 +259,7 @@ void test02()
char largebuf[512];
sprintf(largebuf, "%.*Le", prec, val);
#ifdef __TEST_NUMPUT_VERBOSE
#ifdef TEST_NUMPUT_VERBOSE
cout << "expect: " << largebuf << endl;
cout << "result: " << os.str() << endl;
#endif
@ -298,7 +300,7 @@ int main()
{
test01();
test02();
#ifdef __TEST_NUMPUT_VERBOSE
#ifdef TEST_NUMPUT_VERBOSE
cout << "Test passed!" << endl;
#endif
return 0;