+++ /dev/null
-// 980930 bkoz work with libstdc++v3
-
-// Copyright (C) 1998-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.8 basic_string::compare
-// int compare(const basic_string& str) const;
-// int compare(size_type pos1, size_type n1, const basic_string& str) const;
-// int compare(size_type pos1, size_type n1, const basic_string& str,
-// size_type pos2, size_type n2) const;
-// int compare(const charT* s) const;
-// int compare(size_type pos1, size_type n1,
-// const charT* s, size_type n2 = npos) const;
-
-// NB compare should be thought of as a lexographical compare, ie how
-// things would be sorted in a dictionary.
-
-#include <string>
-#include <cstring>
-#include <testsuite_hooks.h>
-
-enum want_value {lt=0, z=1, gt=2};
-
-int
-test_value(int result, want_value expected);
-
-int
-test_value(int result, want_value expected)
-{
- bool test __attribute__((unused)) = true;
- bool pass = false;
-
- switch (expected) {
- case lt:
- if (result < 0)
- pass = true;
- break;
- case z:
- if (!result)
- pass = true;
- break;
- case gt:
- if (result > 0)
- pass = true;
- break;
- default:
- pass = false; //should not get here
- }
- VERIFY(pass);
- return 0;
-}
-
-
-int
-test01()
-{
- using namespace std;
-
- string str_0("costa rica");
- string str_1("costa marbella");
- string str_2;
-
- //sanity check
- test_value(strcmp("costa marbella", "costa rica"), lt);
- test_value(strcmp("costa rica", "costa rica"), z);
- test_value(strcmp(str_1.data(), str_0.data()), lt);
- test_value(strcmp(str_0.data(), str_1.data()), gt);
- test_value(strncmp(str_1.data(), str_0.data(), 6), z);
- test_value(strncmp(str_1.data(), str_0.data(), 14), lt);
- test_value(memcmp(str_1.data(), str_0.data(), 6), z);
- test_value(memcmp(str_1.data(), str_0.data(), 14), lt);
- test_value(memcmp("costa marbella", "costa rica", 14), lt);
-
- // int compare(const basic_string& str) const;
- test_value(str_0.compare(str_1), gt); //because r>m
- test_value(str_1.compare(str_0), lt); //because m<r
- str_2 = str_0;
- test_value(str_2.compare(str_0), z);
- str_2 = "cost";
- test_value(str_2.compare(str_0), lt);
- str_2 = "costa ricans";
- test_value(str_2.compare(str_0), gt);
-
- // int compare(size_type pos1, size_type n1, const basic_string& str) const;
- test_value(str_1.compare(0, 6, str_0), lt);
- str_2 = "cost";
- test_value(str_1.compare(0, 4, str_2), z);
- test_value(str_1.compare(0, 5, str_2), gt);
-
- // int compare(size_type pos1, size_type n1, const basic_string& str,
- // size_type pos2, size_type n2) const;
- test_value(str_1.compare(0, 6, str_0, 0, 6), z);
- test_value(str_1.compare(0, 7, str_0, 0, 7), lt);
- test_value(str_0.compare(0, 7, str_1, 0, 7), gt);
-
- // int compare(const charT* s) const;
- test_value(str_0.compare("costa marbella"), gt);
- test_value(str_1.compare("costa rica"), lt);
- str_2 = str_0;
- test_value(str_2.compare("costa rica"), z);
- test_value(str_2.compare("cost"), gt);
- test_value(str_2.compare("costa ricans"), lt);
-
- // int compare(size_type pos, size_type n1, const charT* str,
- // size_type n2 = npos) const;
- test_value(str_1.compare(0, 6, "costa rica", 0, 6), z);
- test_value(str_1.compare(0, 7, "costa rica", 0, 7), lt);
- test_value(str_0.compare(0, 7, "costa marbella", 0, 7), gt);
-
- return 0;
-}
-
-
-int
-main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 2004-01-13 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2004-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.8 basic_string::compare [lib.string::compare]
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// libstdc++/13650
-void test01()
-{
- using namespace std;
- bool test __attribute__((unused)) = true;
-
- const char lit_01[] = { 'w', 'e', '\0', 'r', 'd' };
- const char lit_02[] = { 'w', 'e', 'i', '\0', 'd' };
-
- const char lit_ref_a[] = { 'w', 'e', '\0', 'q', 'd' };
- const string str_a(lit_ref_a, 5);
- VERIFY( str_a.compare(0, 5, lit_01, 5) < 0 );
-
- const char lit_ref_b[] = { 'w', 'e', 'i' };
- const string str_b(lit_ref_b, 3);
- VERIFY( str_b.compare(0, 3, lit_02, 5) < 0 );
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 980930 bkoz work with libstdc++v3
-
-// Copyright (C) 1998-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.8 basic_string::compare
-// int compare(const basic_string& str) const;
-// int compare(size_type pos1, size_type n1, const basic_string& str) const;
-// int compare(size_type pos1, size_type n1, const basic_string& str,
-// size_type pos2, size_type n2) const;
-// int compare(const charT* s) const;
-// int compare(size_type pos1, size_type n1,
-// const charT* s, size_type n2 = npos) const;
-
-// NB compare should be thought of as a lexographical compare, ie how
-// things would be sorted in a dictionary.
-
-#include <string>
-#include <testsuite_hooks.h>
-
-enum want_value {lt=0, z=1, gt=2};
-
-int
-test_value(int result, want_value expected);
-
-int
-test_value(int result, want_value expected)
-{
- bool test __attribute__((unused)) = true;
- bool pass = false;
-
- switch (expected) {
- case lt:
- if (result < 0)
- pass = true;
- break;
- case z:
- if (!result)
- pass = true;
- break;
- case gt:
- if (result > 0)
- pass = true;
- break;
- default:
- pass = false; //should not get here
- }
-
- VERIFY(pass);
- return 0;
-}
-
-
-int
-test01()
-{
- using namespace std;
-
- wstring str_0(L"costa rica");
- wstring str_1(L"costa marbella");
- wstring str_2;
-
- //sanity check
- test_value(wcscmp(L"costa marbella", L"costa rica"), lt);
- test_value(wcscmp(L"costa rica", L"costa rica"), z);
- test_value(wcscmp(str_1.data(), str_0.data()), lt);
- test_value(wcscmp(str_0.data(), str_1.data()), gt);
- test_value(wcsncmp(str_1.data(), str_0.data(), 6), z);
- test_value(wcsncmp(str_1.data(), str_0.data(), 14), lt);
- test_value(wmemcmp(str_1.data(), str_0.data(), 6), z);
- test_value(wmemcmp(str_1.data(), str_0.data(), 14), lt);
- test_value(wmemcmp(L"costa marbella", L"costa rica", 14), lt);
-
- // int compare(const basic_string& str) const;
- test_value(str_0.compare(str_1), gt); //because r>m
- test_value(str_1.compare(str_0), lt); //because m<r
- str_2 = str_0;
- test_value(str_2.compare(str_0), z);
- str_2 = L"cost";
- test_value(str_2.compare(str_0), lt);
- str_2 = L"costa ricans";
- test_value(str_2.compare(str_0), gt);
-
- // int compare(size_type pos1, size_type n1, const basic_string& str) const;
- test_value(str_1.compare(0, 6, str_0), lt);
- str_2 = L"cost";
- test_value(str_1.compare(0, 4, str_2), z);
- test_value(str_1.compare(0, 5, str_2), gt);
-
- // int compare(size_type pos1, size_type n1, const basic_string& str,
- // size_type pos2, size_type n2) const;
- test_value(str_1.compare(0, 6, str_0, 0, 6), z);
- test_value(str_1.compare(0, 7, str_0, 0, 7), lt);
- test_value(str_0.compare(0, 7, str_1, 0, 7), gt);
-
- // int compare(const charT* s) const;
- test_value(str_0.compare(L"costa marbella"), gt);
- test_value(str_1.compare(L"costa rica"), lt);
- str_2 = str_0;
- test_value(str_2.compare(L"costa rica"), z);
- test_value(str_2.compare(L"cost"), gt);
- test_value(str_2.compare(L"costa ricans"), lt);
-
- // int compare(size_type pos, size_type n1, const charT* str,
- // size_type n2 = npos) const;
- test_value(str_1.compare(0, 6, L"costa rica", 0, 6), z);
- test_value(str_1.compare(0, 7, L"costa rica", 0, 7), lt);
- test_value(str_0.compare(0, 7, L"costa marbella", 0, 7), gt);
-
- return 0;
-}
-
-
-int
-main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 2004-01-13 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2004-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.8 basic_string::compare [lib.string::compare]
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// libstdc++/13650
-void test01()
-{
- using namespace std;
- bool test __attribute__((unused)) = true;
-
- const wchar_t lit_01[] = { L'w', L'e', L'\0', L'r', L'd' };
- const wchar_t lit_02[] = { L'w', L'e', L'i', L'\0', L'd' };
-
- const wchar_t lit_ref_a[] = { L'w', L'e', L'\0', L'q', L'd' };
- const wstring str_a(lit_ref_a, 5);
- VERIFY( str_a.compare(0, 5, lit_01, 5) < 0 );
-
- const wchar_t lit_ref_b[] = { L'w', L'e', L'i' };
- const wstring str_b(lit_ref_b, 3);
- VERIFY( str_b.compare(0, 3, lit_02, 5) < 0 );
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 1999-06-09 bkoz
-
-// Copyright (C) 1994-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.1 basic_string find
-
-#include <string>
-#include <testsuite_hooks.h>
-
-bool test01(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::string::size_type csize_type;
- typedef std::string::const_reference cref;
- typedef std::string::reference ref;
- csize_type npos = std::string::npos;
- csize_type csz01, csz02;
-
- const char str_lit01[] = "mave";
- const std::string str01("mavericks, santa cruz");
- std::string str02(str_lit01);
- std::string str03("s, s");
- std::string str04;
-
- // size_type find(const string&, size_type pos = 0) const;
- csz01 = str01.find(str01);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str01, 4);
- VERIFY( csz01 == npos );
- csz01 = str01.find(str02, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str02, 3);
- VERIFY( csz01 == npos );
- csz01 = str01.find(str03, 0);
- VERIFY( csz01 == 8 );
- csz01 = str01.find(str03, 3);
- VERIFY( csz01 == 8 );
- csz01 = str01.find(str03, 12);
- VERIFY( csz01 == npos );
-
- // An empty string consists of no characters
- // therefore it should be found at every point in a string,
- // except beyond the end
- csz01 = str01.find(str04, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str04, 5);
- VERIFY( csz01 == 5 );
- csz01 = str01.find(str04, str01.size());
- VERIFY( csz01 == str01.size() );
- csz01 = str01.find(str04, str01.size()+1);
- VERIFY( csz01 == npos );
-
- // size_type find(const char* s, size_type pos, size_type n) const;
- csz01 = str01.find(str_lit01, 0, 3);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str_lit01, 3, 0);
- VERIFY( csz01 == 3 );
-
- // size_type find(const char* s, size_type pos = 0) const;
- csz01 = str01.find(str_lit01);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str_lit01, 3);
- VERIFY( csz01 == npos );
-
- // size_type find(char c, size_type pos = 0) const;
- csz01 = str01.find('z');
- csz02 = str01.size() - 1;
- VERIFY( csz01 == csz02 );
- csz01 = str01.find('/');
- VERIFY( csz01 == npos );
- return test;
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 1999-06-09 bkoz
-
-// Copyright (C) 1994-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.3 basic_string find_first_of
-
-#include <string>
-#include <testsuite_hooks.h>
-
-bool test02(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::string::size_type csize_type;
- csize_type npos = std::string::npos;
- csize_type csz01, csz02;
-
- const char str_lit01[] = "mave";
- const std::string str01("mavericks, santa cruz");
- std::string str02(str_lit01);
- std::string str03("s, s");
- std::string str04;
-
- // size_type find_first_of(const string&, size_type pos = 0) const;
- std::string str05("xena rulez");
- csz01 = str01.find_first_of(str01);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_of(str01, 4);
- VERIFY( csz01 == 4 );
- csz01 = str01.find_first_of(str02, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_of(str02, 3);
- VERIFY( csz01 == 3 );
- csz01 = str01.find_first_of(str03, 0);
- VERIFY( csz01 == 8 );
- csz01 = str01.find_first_of(str03, 3);
- VERIFY( csz01 == 8 );
- csz01 = str01.find_first_of(str03, 12);
- VERIFY( csz01 == 16 );
- csz01 = str01.find_first_of(str05, 0);
- VERIFY( csz01 == 1 );
- csz01 = str01.find_first_of(str05, 4);
- VERIFY( csz01 == 4 );
-
- // An empty string consists of no characters
- // therefore it should be found at every point in a string,
- // except beyond the end
- // However, str1.find_first_of(str2,pos) finds the first character in
- // str1 (starting at pos) that exists in str2, which is none for empty str2
- csz01 = str01.find_first_of(str04, 0);
- VERIFY( csz01 == npos );
- csz01 = str01.find_first_of(str04, 5);
- VERIFY( csz01 == npos );
-
- // size_type find_first_of(const char* s, size_type pos, size_type n) const;
- csz01 = str01.find_first_of(str_lit01, 0, 3);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_of(str_lit01, 3, 0);
- VERIFY( csz01 == npos );
-
- // size_type find_first_of(const char* s, size_type pos = 0) const;
- csz01 = str01.find_first_of(str_lit01);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_of(str_lit01, 3);
- VERIFY( csz01 == 3 );
-
- // size_type find_first_of(char c, size_type pos = 0) const;
- csz01 = str01.find_first_of('z');
- csz02 = str01.size() - 1;
- VERIFY( csz01 == csz02 );
- return test;
-}
-
-int main()
-{
- test02();
- return 0;
-}
+++ /dev/null
-// 2003-05-04 Paolo Carlini <pcarlini@unitus.it>
-
-// Copyright (C) 2003-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.5 basic_string find_first_not_of
-
-#include <string>
-#include <testsuite_hooks.h>
-
-bool test03(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::string::size_type csize_type;
- csize_type npos = std::string::npos;
- csize_type csz01;
-
- const std::string str01("Bob Rock, per me");
- const char str_lit01[] = "Bob Rock";
- std::string str02("ovvero Trivi");
- std::string str03(str_lit01);
- std::string str04;
-
- // size_type find_first_not_of(const string&, size_type pos = 0) const;
- csz01 = str01.find_first_not_of(str01);
- VERIFY( csz01 == npos );
- csz01 = str01.find_first_not_of(str02, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_not_of(str02, 10);
- VERIFY( csz01 == 10 );
- csz01 = str01.find_first_not_of(str02, 12);
- VERIFY( csz01 == 14 );
- csz01 = str01.find_first_not_of(str03, 0);
- VERIFY( csz01 == 8 );
- csz01 = str01.find_first_not_of(str03, 15);
- VERIFY( csz01 == 15 );
- csz01 = str01.find_first_not_of(str03, 16);
- VERIFY( csz01 == npos );
- csz01 = str01.find_first_not_of(str04, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_not_of(str04, 12);
- VERIFY( csz01 == 12 );
- csz01 = str03.find_first_not_of(str01, 0);
- VERIFY( csz01 == npos );
- csz01 = str04.find_first_not_of(str02, 0);
- VERIFY( csz01 == npos );
-
- // size_type find_first_not_of(const char* s, size_type pos, size_type n) const;
- csz01 = str01.find_first_not_of(str_lit01, 0, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_not_of(str_lit01, 0, 8);
- VERIFY( csz01 == 8 );
- csz01 = str01.find_first_not_of(str_lit01, 10, 0);
- VERIFY( csz01 == 10 );
-
- // size_type find_first_not_of(const char* s, size_type pos = 0) const;
- csz01 = str01.find_first_not_of(str_lit01);
- VERIFY( csz01 == 8 );
- csz01 = str02.find_first_not_of(str_lit01, 2);
- VERIFY( csz01 == 2 );
-
- // size_type find_first_not_of(char c, size_type pos = 0) const;
- csz01 = str01.find_first_not_of('B');
- VERIFY( csz01 == 1 );
- csz01 = str01.find_first_not_of('o', 1);
- VERIFY( csz01 == 2 );
- csz01 = str02.find_first_not_of('z');
- VERIFY( csz01 == 0 );
- csz01 = str04.find_first_not_of('S');
- VERIFY( csz01 == npos );
- return test;
-}
-
-int main()
-{
- test03();
- return 0;
-}
+++ /dev/null
-// 2007-03-30 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2007-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.1 basic_string find
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// libstdc++/31401
-void test01()
-{
- bool test __attribute__((unused)) = true;
- typedef std::string::size_type csize_type;
- csize_type npos = std::string::npos;
-
- std::string use = "anu";
- csize_type pos1 = use.find("a", npos);
-
- VERIFY( pos1 == npos );
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 1999-06-09 bkoz
-
-// Copyright (C) 1994-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.1 basic_string find
-
-#include <string>
-#include <testsuite_hooks.h>
-
-bool test01(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::wstring::size_type csize_type;
- typedef std::wstring::const_reference cref;
- typedef std::wstring::reference ref;
- csize_type npos = std::wstring::npos;
- csize_type csz01, csz02;
-
- const wchar_t str_lit01[] = L"mave";
- const std::wstring str01(L"mavericks, santa cruz");
- std::wstring str02(str_lit01);
- std::wstring str03(L"s, s");
- std::wstring str04;
-
- // size_type find(const wstring&, size_type pos = 0) const;
- csz01 = str01.find(str01);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str01, 4);
- VERIFY( csz01 == npos );
- csz01 = str01.find(str02, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str02, 3);
- VERIFY( csz01 == npos );
- csz01 = str01.find(str03, 0);
- VERIFY( csz01 == 8 );
- csz01 = str01.find(str03, 3);
- VERIFY( csz01 == 8 );
- csz01 = str01.find(str03, 12);
- VERIFY( csz01 == npos );
-
- // An empty string consists of no characters
- // therefore it should be found at every point in a string,
- // except beyond the end
- csz01 = str01.find(str04, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str04, 5);
- VERIFY( csz01 == 5 );
- csz01 = str01.find(str04, str01.size());
- VERIFY( csz01 == str01.size() );
- csz01 = str01.find(str04, str01.size()+1);
- VERIFY( csz01 == npos );
-
- // size_type find(const wchar_t* s, size_type pos, size_type n) const;
- csz01 = str01.find(str_lit01, 0, 3);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str_lit01, 3, 0);
- VERIFY( csz01 == 3 );
-
- // size_type find(const wchar_t* s, size_type pos = 0) const;
- csz01 = str01.find(str_lit01);
- VERIFY( csz01 == 0 );
- csz01 = str01.find(str_lit01, 3);
- VERIFY( csz01 == npos );
-
- // size_type find(wchar_t c, size_type pos = 0) const;
- csz01 = str01.find(L'z');
- csz02 = str01.size() - 1;
- VERIFY( csz01 == csz02 );
- csz01 = str01.find(L'/');
- VERIFY( csz01 == npos );
- return test;
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 1999-06-09 bkoz
-
-// Copyright (C) 1994-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.3 basic_string find_first_of
-
-#include <string>
-#include <testsuite_hooks.h>
-
-bool test02(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::wstring::size_type csize_type;
- csize_type npos = std::wstring::npos;
- csize_type csz01, csz02;
-
- const wchar_t str_lit01[] = L"mave";
- const std::wstring str01(L"mavericks, santa cruz");
- std::wstring str02(str_lit01);
- std::wstring str03(L"s, s");
- std::wstring str04;
-
- // size_type find_first_of(const wstring&, size_type pos = 0) const;
- std::wstring str05(L"xena rulez");
- csz01 = str01.find_first_of(str01);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_of(str01, 4);
- VERIFY( csz01 == 4 );
- csz01 = str01.find_first_of(str02, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_of(str02, 3);
- VERIFY( csz01 == 3 );
- csz01 = str01.find_first_of(str03, 0);
- VERIFY( csz01 == 8 );
- csz01 = str01.find_first_of(str03, 3);
- VERIFY( csz01 == 8 );
- csz01 = str01.find_first_of(str03, 12);
- VERIFY( csz01 == 16 );
- csz01 = str01.find_first_of(str05, 0);
- VERIFY( csz01 == 1 );
- csz01 = str01.find_first_of(str05, 4);
- VERIFY( csz01 == 4 );
-
- // An empty string consists of no characters
- // therefore it should be found at every point in a string,
- // except beyond the end
- // However, str1.find_first_of(str2,pos) finds the first character in
- // str1 (starting at pos) that exists in str2, which is none for empty str2
- csz01 = str01.find_first_of(str04, 0);
- VERIFY( csz01 == npos );
- csz01 = str01.find_first_of(str04, 5);
- VERIFY( csz01 == npos );
-
- // size_type find_first_of(const wchar_t* s, size_type pos, size_type n) const;
- csz01 = str01.find_first_of(str_lit01, 0, 3);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_of(str_lit01, 3, 0);
- VERIFY( csz01 == npos );
-
- // size_type find_first_of(const wchar_t* s, size_type pos = 0) const;
- csz01 = str01.find_first_of(str_lit01);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_of(str_lit01, 3);
- VERIFY( csz01 == 3 );
-
- // size_type find_first_of(wchar_t c, size_type pos = 0) const;
- csz01 = str01.find_first_of(L'z');
- csz02 = str01.size() - 1;
- VERIFY( csz01 == csz02 );
- return test;
-}
-
-int main()
-{
- test02();
- return 0;
-}
+++ /dev/null
-// 2003-05-04 Paolo Carlini <pcarlini@unitus.it>
-
-// Copyright (C) 2003-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.5 basic_string find_first_not_of
-
-#include <string>
-#include <testsuite_hooks.h>
-
-bool test03(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::wstring::size_type csize_type;
- csize_type npos = std::wstring::npos;
- csize_type csz01;
-
- const std::wstring str01(L"Bob Rock, per me");
- const wchar_t str_lit01[] = L"Bob Rock";
- std::wstring str02(L"ovvero Trivi");
- std::wstring str03(str_lit01);
- std::wstring str04;
-
- // size_type find_first_not_of(const string&, size_type pos = 0) const;
- csz01 = str01.find_first_not_of(str01);
- VERIFY( csz01 == npos );
- csz01 = str01.find_first_not_of(str02, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_not_of(str02, 10);
- VERIFY( csz01 == 10 );
- csz01 = str01.find_first_not_of(str02, 12);
- VERIFY( csz01 == 14 );
- csz01 = str01.find_first_not_of(str03, 0);
- VERIFY( csz01 == 8 );
- csz01 = str01.find_first_not_of(str03, 15);
- VERIFY( csz01 == 15 );
- csz01 = str01.find_first_not_of(str03, 16);
- VERIFY( csz01 == npos );
- csz01 = str01.find_first_not_of(str04, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_not_of(str04, 12);
- VERIFY( csz01 == 12 );
- csz01 = str03.find_first_not_of(str01, 0);
- VERIFY( csz01 == npos );
- csz01 = str04.find_first_not_of(str02, 0);
- VERIFY( csz01 == npos );
-
- // size_type find_first_not_of(const char* s, size_type pos, size_type n) const;
- csz01 = str01.find_first_not_of(str_lit01, 0, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.find_first_not_of(str_lit01, 0, 8);
- VERIFY( csz01 == 8 );
- csz01 = str01.find_first_not_of(str_lit01, 10, 0);
- VERIFY( csz01 == 10 );
-
- // size_type find_first_not_of(const char* s, size_type pos = 0) const;
- csz01 = str01.find_first_not_of(str_lit01);
- VERIFY( csz01 == 8 );
- csz01 = str02.find_first_not_of(str_lit01, 2);
- VERIFY( csz01 == 2 );
-
- // size_type find_first_not_of(char c, size_type pos = 0) const;
- csz01 = str01.find_first_not_of(L'B');
- VERIFY( csz01 == 1 );
- csz01 = str01.find_first_not_of(L'o', 1);
- VERIFY( csz01 == 2 );
- csz01 = str02.find_first_not_of(L'z');
- VERIFY( csz01 == 0 );
- csz01 = str04.find_first_not_of(L'S');
- VERIFY( csz01 == npos );
- return test;
-}
-
-int main()
-{
- test03();
- return 0;
-}
+++ /dev/null
-// 2007-03-30 Paolo Carlini <pcarlini@suse.de>
-
-// Copyright (C) 2007-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.1 basic_string find
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// libstdc++/31401
-void test01()
-{
- bool test __attribute__((unused)) = true;
- typedef std::wstring::size_type csize_type;
- csize_type npos = std::wstring::npos;
-
- std::wstring use = L"anu";
- csize_type pos1 = use.find(L"a", npos);
-
- VERIFY( pos1 == npos );
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// Copyright (C) 2004-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6 string operations
-
-#include <string>
-#include <testsuite_hooks.h>
-
-int test01(void)
-{
- bool test __attribute__((unused)) = true;
-
- std::string empty;
-
- // data() for size == 0 is non-NULL.
- VERIFY( empty.size() == 0 );
- const std::string::value_type* p = empty.data();
- VERIFY( p );
-
- return 0;
-}
-
-int main()
-{
- test01();
- return 0;
-}
--- /dev/null
+// 980930 bkoz work with libstdc++v3
+
+// Copyright (C) 1998-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.8 basic_string::compare
+// int compare(const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str,
+// size_type pos2, size_type n2) const;
+// int compare(const charT* s) const;
+// int compare(size_type pos1, size_type n1,
+// const charT* s, size_type n2 = npos) const;
+
+// NB compare should be thought of as a lexographical compare, ie how
+// things would be sorted in a dictionary.
+
+#include <string>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+enum want_value {lt=0, z=1, gt=2};
+
+int
+test_value(int result, want_value expected);
+
+int
+test_value(int result, want_value expected)
+{
+ bool test __attribute__((unused)) = true;
+ bool pass = false;
+
+ switch (expected) {
+ case lt:
+ if (result < 0)
+ pass = true;
+ break;
+ case z:
+ if (!result)
+ pass = true;
+ break;
+ case gt:
+ if (result > 0)
+ pass = true;
+ break;
+ default:
+ pass = false; //should not get here
+ }
+ VERIFY(pass);
+ return 0;
+}
+
+
+int
+test01()
+{
+ using namespace std;
+
+ string str_0("costa rica");
+ string str_1("costa marbella");
+ string str_2;
+
+ //sanity check
+ test_value(strcmp("costa marbella", "costa rica"), lt);
+ test_value(strcmp("costa rica", "costa rica"), z);
+ test_value(strcmp(str_1.data(), str_0.data()), lt);
+ test_value(strcmp(str_0.data(), str_1.data()), gt);
+ test_value(strncmp(str_1.data(), str_0.data(), 6), z);
+ test_value(strncmp(str_1.data(), str_0.data(), 14), lt);
+ test_value(memcmp(str_1.data(), str_0.data(), 6), z);
+ test_value(memcmp(str_1.data(), str_0.data(), 14), lt);
+ test_value(memcmp("costa marbella", "costa rica", 14), lt);
+
+ // int compare(const basic_string& str) const;
+ test_value(str_0.compare(str_1), gt); //because r>m
+ test_value(str_1.compare(str_0), lt); //because m<r
+ str_2 = str_0;
+ test_value(str_2.compare(str_0), z);
+ str_2 = "cost";
+ test_value(str_2.compare(str_0), lt);
+ str_2 = "costa ricans";
+ test_value(str_2.compare(str_0), gt);
+
+ // int compare(size_type pos1, size_type n1, const basic_string& str) const;
+ test_value(str_1.compare(0, 6, str_0), lt);
+ str_2 = "cost";
+ test_value(str_1.compare(0, 4, str_2), z);
+ test_value(str_1.compare(0, 5, str_2), gt);
+
+ // int compare(size_type pos1, size_type n1, const basic_string& str,
+ // size_type pos2, size_type n2) const;
+ test_value(str_1.compare(0, 6, str_0, 0, 6), z);
+ test_value(str_1.compare(0, 7, str_0, 0, 7), lt);
+ test_value(str_0.compare(0, 7, str_1, 0, 7), gt);
+
+ // int compare(const charT* s) const;
+ test_value(str_0.compare("costa marbella"), gt);
+ test_value(str_1.compare("costa rica"), lt);
+ str_2 = str_0;
+ test_value(str_2.compare("costa rica"), z);
+ test_value(str_2.compare("cost"), gt);
+ test_value(str_2.compare("costa ricans"), lt);
+
+ // int compare(size_type pos, size_type n1, const charT* str,
+ // size_type n2 = npos) const;
+ test_value(str_1.compare(0, 6, "costa rica", 0, 6), z);
+ test_value(str_1.compare(0, 7, "costa rica", 0, 7), lt);
+ test_value(str_0.compare(0, 7, "costa marbella", 0, 7), gt);
+
+ return 0;
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 2004-01-13 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2004-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.8 basic_string::compare [lib.string::compare]
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/13650
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ const char lit_01[] = { 'w', 'e', '\0', 'r', 'd' };
+ const char lit_02[] = { 'w', 'e', 'i', '\0', 'd' };
+
+ const char lit_ref_a[] = { 'w', 'e', '\0', 'q', 'd' };
+ const string str_a(lit_ref_a, 5);
+ VERIFY( str_a.compare(0, 5, lit_01, 5) < 0 );
+
+ const char lit_ref_b[] = { 'w', 'e', 'i' };
+ const string str_b(lit_ref_b, 3);
+ VERIFY( str_b.compare(0, 3, lit_02, 5) < 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 980930 bkoz work with libstdc++v3
+
+// Copyright (C) 1998-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.8 basic_string::compare
+// int compare(const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str) const;
+// int compare(size_type pos1, size_type n1, const basic_string& str,
+// size_type pos2, size_type n2) const;
+// int compare(const charT* s) const;
+// int compare(size_type pos1, size_type n1,
+// const charT* s, size_type n2 = npos) const;
+
+// NB compare should be thought of as a lexographical compare, ie how
+// things would be sorted in a dictionary.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+enum want_value {lt=0, z=1, gt=2};
+
+int
+test_value(int result, want_value expected);
+
+int
+test_value(int result, want_value expected)
+{
+ bool test __attribute__((unused)) = true;
+ bool pass = false;
+
+ switch (expected) {
+ case lt:
+ if (result < 0)
+ pass = true;
+ break;
+ case z:
+ if (!result)
+ pass = true;
+ break;
+ case gt:
+ if (result > 0)
+ pass = true;
+ break;
+ default:
+ pass = false; //should not get here
+ }
+
+ VERIFY(pass);
+ return 0;
+}
+
+
+int
+test01()
+{
+ using namespace std;
+
+ wstring str_0(L"costa rica");
+ wstring str_1(L"costa marbella");
+ wstring str_2;
+
+ //sanity check
+ test_value(wcscmp(L"costa marbella", L"costa rica"), lt);
+ test_value(wcscmp(L"costa rica", L"costa rica"), z);
+ test_value(wcscmp(str_1.data(), str_0.data()), lt);
+ test_value(wcscmp(str_0.data(), str_1.data()), gt);
+ test_value(wcsncmp(str_1.data(), str_0.data(), 6), z);
+ test_value(wcsncmp(str_1.data(), str_0.data(), 14), lt);
+ test_value(wmemcmp(str_1.data(), str_0.data(), 6), z);
+ test_value(wmemcmp(str_1.data(), str_0.data(), 14), lt);
+ test_value(wmemcmp(L"costa marbella", L"costa rica", 14), lt);
+
+ // int compare(const basic_string& str) const;
+ test_value(str_0.compare(str_1), gt); //because r>m
+ test_value(str_1.compare(str_0), lt); //because m<r
+ str_2 = str_0;
+ test_value(str_2.compare(str_0), z);
+ str_2 = L"cost";
+ test_value(str_2.compare(str_0), lt);
+ str_2 = L"costa ricans";
+ test_value(str_2.compare(str_0), gt);
+
+ // int compare(size_type pos1, size_type n1, const basic_string& str) const;
+ test_value(str_1.compare(0, 6, str_0), lt);
+ str_2 = L"cost";
+ test_value(str_1.compare(0, 4, str_2), z);
+ test_value(str_1.compare(0, 5, str_2), gt);
+
+ // int compare(size_type pos1, size_type n1, const basic_string& str,
+ // size_type pos2, size_type n2) const;
+ test_value(str_1.compare(0, 6, str_0, 0, 6), z);
+ test_value(str_1.compare(0, 7, str_0, 0, 7), lt);
+ test_value(str_0.compare(0, 7, str_1, 0, 7), gt);
+
+ // int compare(const charT* s) const;
+ test_value(str_0.compare(L"costa marbella"), gt);
+ test_value(str_1.compare(L"costa rica"), lt);
+ str_2 = str_0;
+ test_value(str_2.compare(L"costa rica"), z);
+ test_value(str_2.compare(L"cost"), gt);
+ test_value(str_2.compare(L"costa ricans"), lt);
+
+ // int compare(size_type pos, size_type n1, const charT* str,
+ // size_type n2 = npos) const;
+ test_value(str_1.compare(0, 6, L"costa rica", 0, 6), z);
+ test_value(str_1.compare(0, 7, L"costa rica", 0, 7), lt);
+ test_value(str_0.compare(0, 7, L"costa marbella", 0, 7), gt);
+
+ return 0;
+}
+
+
+int
+main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 2004-01-13 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2004-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.8 basic_string::compare [lib.string::compare]
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/13650
+void test01()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+
+ const wchar_t lit_01[] = { L'w', L'e', L'\0', L'r', L'd' };
+ const wchar_t lit_02[] = { L'w', L'e', L'i', L'\0', L'd' };
+
+ const wchar_t lit_ref_a[] = { L'w', L'e', L'\0', L'q', L'd' };
+ const wstring str_a(lit_ref_a, 5);
+ VERIFY( str_a.compare(0, 5, lit_01, 5) < 0 );
+
+ const wchar_t lit_ref_b[] = { L'w', L'e', L'i' };
+ const wstring str_b(lit_ref_b, 3);
+ VERIFY( str_b.compare(0, 3, lit_02, 5) < 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// Copyright (C) 2004-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6 string operations
+
+#include <string>
+#include <testsuite_hooks.h>
+
+int test01(void)
+{
+ bool test __attribute__((unused)) = true;
+
+ std::string empty;
+
+ // data() for size == 0 is non-NULL.
+ VERIFY( empty.size() == 0 );
+ const std::string::value_type* p = empty.data();
+ VERIFY( p );
+
+ return 0;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// Copyright (C) 2004-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6 string operations
+
+#include <string>
+#include <testsuite_hooks.h>
+
+int test01(void)
+{
+ bool test __attribute__((unused)) = true;
+
+ std::wstring empty;
+
+ // data() for size == 0 is non-NULL.
+ VERIFY( empty.size() == 0 );
+ const std::wstring::value_type* p = empty.data();
+ VERIFY( p );
+
+ return 0;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 1999-06-09 bkoz
+
+// Copyright (C) 1994-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.1 basic_string find
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "mave";
+ const std::string str01("mavericks, santa cruz");
+ std::string str02(str_lit01);
+ std::string str03("s, s");
+ std::string str04;
+
+ // size_type find(const string&, size_type pos = 0) const;
+ csz01 = str01.find(str01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str01, 4);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find(str02, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str02, 3);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find(str03, 0);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find(str03, 3);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find(str03, 12);
+ VERIFY( csz01 == npos );
+
+ // An empty string consists of no characters
+ // therefore it should be found at every point in a string,
+ // except beyond the end
+ csz01 = str01.find(str04, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str04, 5);
+ VERIFY( csz01 == 5 );
+ csz01 = str01.find(str04, str01.size());
+ VERIFY( csz01 == str01.size() );
+ csz01 = str01.find(str04, str01.size()+1);
+ VERIFY( csz01 == npos );
+
+ // size_type find(const char* s, size_type pos, size_type n) const;
+ csz01 = str01.find(str_lit01, 0, 3);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str_lit01, 3, 0);
+ VERIFY( csz01 == 3 );
+
+ // size_type find(const char* s, size_type pos = 0) const;
+ csz01 = str01.find(str_lit01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str_lit01, 3);
+ VERIFY( csz01 == npos );
+
+ // size_type find(char c, size_type pos = 0) const;
+ csz01 = str01.find('z');
+ csz02 = str01.size() - 1;
+ VERIFY( csz01 == csz02 );
+ csz01 = str01.find('/');
+ VERIFY( csz01 == npos );
+ return test;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 1999-06-09 bkoz
+
+// Copyright (C) 1994-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.3 basic_string find_first_of
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test02(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::string::size_type csize_type;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "mave";
+ const std::string str01("mavericks, santa cruz");
+ std::string str02(str_lit01);
+ std::string str03("s, s");
+ std::string str04;
+
+ // size_type find_first_of(const string&, size_type pos = 0) const;
+ std::string str05("xena rulez");
+ csz01 = str01.find_first_of(str01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_of(str01, 4);
+ VERIFY( csz01 == 4 );
+ csz01 = str01.find_first_of(str02, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_of(str02, 3);
+ VERIFY( csz01 == 3 );
+ csz01 = str01.find_first_of(str03, 0);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find_first_of(str03, 3);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find_first_of(str03, 12);
+ VERIFY( csz01 == 16 );
+ csz01 = str01.find_first_of(str05, 0);
+ VERIFY( csz01 == 1 );
+ csz01 = str01.find_first_of(str05, 4);
+ VERIFY( csz01 == 4 );
+
+ // An empty string consists of no characters
+ // therefore it should be found at every point in a string,
+ // except beyond the end
+ // However, str1.find_first_of(str2,pos) finds the first character in
+ // str1 (starting at pos) that exists in str2, which is none for empty str2
+ csz01 = str01.find_first_of(str04, 0);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find_first_of(str04, 5);
+ VERIFY( csz01 == npos );
+
+ // size_type find_first_of(const char* s, size_type pos, size_type n) const;
+ csz01 = str01.find_first_of(str_lit01, 0, 3);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_of(str_lit01, 3, 0);
+ VERIFY( csz01 == npos );
+
+ // size_type find_first_of(const char* s, size_type pos = 0) const;
+ csz01 = str01.find_first_of(str_lit01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_of(str_lit01, 3);
+ VERIFY( csz01 == 3 );
+
+ // size_type find_first_of(char c, size_type pos = 0) const;
+ csz01 = str01.find_first_of('z');
+ csz02 = str01.size() - 1;
+ VERIFY( csz01 == csz02 );
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 2003-05-04 Paolo Carlini <pcarlini@unitus.it>
+
+// Copyright (C) 2003-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.5 basic_string find_first_not_of
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test03(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::string::size_type csize_type;
+ csize_type npos = std::string::npos;
+ csize_type csz01;
+
+ const std::string str01("Bob Rock, per me");
+ const char str_lit01[] = "Bob Rock";
+ std::string str02("ovvero Trivi");
+ std::string str03(str_lit01);
+ std::string str04;
+
+ // size_type find_first_not_of(const string&, size_type pos = 0) const;
+ csz01 = str01.find_first_not_of(str01);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find_first_not_of(str02, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_not_of(str02, 10);
+ VERIFY( csz01 == 10 );
+ csz01 = str01.find_first_not_of(str02, 12);
+ VERIFY( csz01 == 14 );
+ csz01 = str01.find_first_not_of(str03, 0);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find_first_not_of(str03, 15);
+ VERIFY( csz01 == 15 );
+ csz01 = str01.find_first_not_of(str03, 16);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find_first_not_of(str04, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_not_of(str04, 12);
+ VERIFY( csz01 == 12 );
+ csz01 = str03.find_first_not_of(str01, 0);
+ VERIFY( csz01 == npos );
+ csz01 = str04.find_first_not_of(str02, 0);
+ VERIFY( csz01 == npos );
+
+ // size_type find_first_not_of(const char* s, size_type pos, size_type n) const;
+ csz01 = str01.find_first_not_of(str_lit01, 0, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_not_of(str_lit01, 0, 8);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find_first_not_of(str_lit01, 10, 0);
+ VERIFY( csz01 == 10 );
+
+ // size_type find_first_not_of(const char* s, size_type pos = 0) const;
+ csz01 = str01.find_first_not_of(str_lit01);
+ VERIFY( csz01 == 8 );
+ csz01 = str02.find_first_not_of(str_lit01, 2);
+ VERIFY( csz01 == 2 );
+
+ // size_type find_first_not_of(char c, size_type pos = 0) const;
+ csz01 = str01.find_first_not_of('B');
+ VERIFY( csz01 == 1 );
+ csz01 = str01.find_first_not_of('o', 1);
+ VERIFY( csz01 == 2 );
+ csz01 = str02.find_first_not_of('z');
+ VERIFY( csz01 == 0 );
+ csz01 = str04.find_first_not_of('S');
+ VERIFY( csz01 == npos );
+ return test;
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
--- /dev/null
+// 2007-03-30 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.1 basic_string find
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/31401
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::string::size_type csize_type;
+ csize_type npos = std::string::npos;
+
+ std::string use = "anu";
+ csize_type pos1 = use.find("a", npos);
+
+ VERIFY( pos1 == npos );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 1999-06-09 bkoz
+
+// Copyright (C) 1994-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.1 basic_string find
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::wstring::size_type csize_type;
+ typedef std::wstring::const_reference cref;
+ typedef std::wstring::reference ref;
+ csize_type npos = std::wstring::npos;
+ csize_type csz01, csz02;
+
+ const wchar_t str_lit01[] = L"mave";
+ const std::wstring str01(L"mavericks, santa cruz");
+ std::wstring str02(str_lit01);
+ std::wstring str03(L"s, s");
+ std::wstring str04;
+
+ // size_type find(const wstring&, size_type pos = 0) const;
+ csz01 = str01.find(str01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str01, 4);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find(str02, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str02, 3);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find(str03, 0);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find(str03, 3);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find(str03, 12);
+ VERIFY( csz01 == npos );
+
+ // An empty string consists of no characters
+ // therefore it should be found at every point in a string,
+ // except beyond the end
+ csz01 = str01.find(str04, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str04, 5);
+ VERIFY( csz01 == 5 );
+ csz01 = str01.find(str04, str01.size());
+ VERIFY( csz01 == str01.size() );
+ csz01 = str01.find(str04, str01.size()+1);
+ VERIFY( csz01 == npos );
+
+ // size_type find(const wchar_t* s, size_type pos, size_type n) const;
+ csz01 = str01.find(str_lit01, 0, 3);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str_lit01, 3, 0);
+ VERIFY( csz01 == 3 );
+
+ // size_type find(const wchar_t* s, size_type pos = 0) const;
+ csz01 = str01.find(str_lit01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find(str_lit01, 3);
+ VERIFY( csz01 == npos );
+
+ // size_type find(wchar_t c, size_type pos = 0) const;
+ csz01 = str01.find(L'z');
+ csz02 = str01.size() - 1;
+ VERIFY( csz01 == csz02 );
+ csz01 = str01.find(L'/');
+ VERIFY( csz01 == npos );
+ return test;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 1999-06-09 bkoz
+
+// Copyright (C) 1994-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.3 basic_string find_first_of
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test02(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::wstring::size_type csize_type;
+ csize_type npos = std::wstring::npos;
+ csize_type csz01, csz02;
+
+ const wchar_t str_lit01[] = L"mave";
+ const std::wstring str01(L"mavericks, santa cruz");
+ std::wstring str02(str_lit01);
+ std::wstring str03(L"s, s");
+ std::wstring str04;
+
+ // size_type find_first_of(const wstring&, size_type pos = 0) const;
+ std::wstring str05(L"xena rulez");
+ csz01 = str01.find_first_of(str01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_of(str01, 4);
+ VERIFY( csz01 == 4 );
+ csz01 = str01.find_first_of(str02, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_of(str02, 3);
+ VERIFY( csz01 == 3 );
+ csz01 = str01.find_first_of(str03, 0);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find_first_of(str03, 3);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find_first_of(str03, 12);
+ VERIFY( csz01 == 16 );
+ csz01 = str01.find_first_of(str05, 0);
+ VERIFY( csz01 == 1 );
+ csz01 = str01.find_first_of(str05, 4);
+ VERIFY( csz01 == 4 );
+
+ // An empty string consists of no characters
+ // therefore it should be found at every point in a string,
+ // except beyond the end
+ // However, str1.find_first_of(str2,pos) finds the first character in
+ // str1 (starting at pos) that exists in str2, which is none for empty str2
+ csz01 = str01.find_first_of(str04, 0);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find_first_of(str04, 5);
+ VERIFY( csz01 == npos );
+
+ // size_type find_first_of(const wchar_t* s, size_type pos, size_type n) const;
+ csz01 = str01.find_first_of(str_lit01, 0, 3);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_of(str_lit01, 3, 0);
+ VERIFY( csz01 == npos );
+
+ // size_type find_first_of(const wchar_t* s, size_type pos = 0) const;
+ csz01 = str01.find_first_of(str_lit01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_of(str_lit01, 3);
+ VERIFY( csz01 == 3 );
+
+ // size_type find_first_of(wchar_t c, size_type pos = 0) const;
+ csz01 = str01.find_first_of(L'z');
+ csz02 = str01.size() - 1;
+ VERIFY( csz01 == csz02 );
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// 2003-05-04 Paolo Carlini <pcarlini@unitus.it>
+
+// Copyright (C) 2003-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.5 basic_string find_first_not_of
+
+#include <string>
+#include <testsuite_hooks.h>
+
+bool test03(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::wstring::size_type csize_type;
+ csize_type npos = std::wstring::npos;
+ csize_type csz01;
+
+ const std::wstring str01(L"Bob Rock, per me");
+ const wchar_t str_lit01[] = L"Bob Rock";
+ std::wstring str02(L"ovvero Trivi");
+ std::wstring str03(str_lit01);
+ std::wstring str04;
+
+ // size_type find_first_not_of(const string&, size_type pos = 0) const;
+ csz01 = str01.find_first_not_of(str01);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find_first_not_of(str02, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_not_of(str02, 10);
+ VERIFY( csz01 == 10 );
+ csz01 = str01.find_first_not_of(str02, 12);
+ VERIFY( csz01 == 14 );
+ csz01 = str01.find_first_not_of(str03, 0);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find_first_not_of(str03, 15);
+ VERIFY( csz01 == 15 );
+ csz01 = str01.find_first_not_of(str03, 16);
+ VERIFY( csz01 == npos );
+ csz01 = str01.find_first_not_of(str04, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_not_of(str04, 12);
+ VERIFY( csz01 == 12 );
+ csz01 = str03.find_first_not_of(str01, 0);
+ VERIFY( csz01 == npos );
+ csz01 = str04.find_first_not_of(str02, 0);
+ VERIFY( csz01 == npos );
+
+ // size_type find_first_not_of(const char* s, size_type pos, size_type n) const;
+ csz01 = str01.find_first_not_of(str_lit01, 0, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.find_first_not_of(str_lit01, 0, 8);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.find_first_not_of(str_lit01, 10, 0);
+ VERIFY( csz01 == 10 );
+
+ // size_type find_first_not_of(const char* s, size_type pos = 0) const;
+ csz01 = str01.find_first_not_of(str_lit01);
+ VERIFY( csz01 == 8 );
+ csz01 = str02.find_first_not_of(str_lit01, 2);
+ VERIFY( csz01 == 2 );
+
+ // size_type find_first_not_of(char c, size_type pos = 0) const;
+ csz01 = str01.find_first_not_of(L'B');
+ VERIFY( csz01 == 1 );
+ csz01 = str01.find_first_not_of(L'o', 1);
+ VERIFY( csz01 == 2 );
+ csz01 = str02.find_first_not_of(L'z');
+ VERIFY( csz01 == 0 );
+ csz01 = str04.find_first_not_of(L'S');
+ VERIFY( csz01 == npos );
+ return test;
+}
+
+int main()
+{
+ test03();
+ return 0;
+}
--- /dev/null
+// 2007-03-30 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2007-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.1 basic_string find
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// libstdc++/31401
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::wstring::size_type csize_type;
+ csize_type npos = std::wstring::npos;
+
+ std::wstring use = L"anu";
+ csize_type pos1 = use.find(L"a", npos);
+
+ VERIFY( pos1 == npos );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc)
+
+// Copyright (C) 2000-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.2 basic_string rfind
+bool test01(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type npos = std::string::npos;
+ csize_type csz01, csz02;
+
+ const char str_lit01[] = "mave";
+ const std::string str01("mavericks, santa cruz");
+ std::string str02(str_lit01);
+ std::string str03("s, s");
+ std::string str04;
+
+ // size_type rfind(const string&, size_type pos = 0) const;
+ csz01 = str01.rfind(str01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str01, 4);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str02,3);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str02);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str03);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.rfind(str03, 3);
+ VERIFY( csz01 == npos );
+ csz01 = str01.rfind(str03, 12);
+ VERIFY( csz01 == 8 );
+
+ // An empty string consists of no characters
+ // therefore it should be found at every point in a string,
+ // except beyond the end
+ csz01 = str01.rfind(str04, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str04, 5);
+ VERIFY( csz01 == 5 );
+ csz01 = str01.rfind(str04, str01.size());
+ VERIFY( csz01 == str01.size() );
+ csz01 = str01.rfind(str04, str01.size()+1);
+ VERIFY( csz01 == str01.size() );
+
+ // size_type rfind(const char* s, size_type pos, size_type n) const;
+ csz01 = str01.rfind(str_lit01, 0, 3);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str_lit01, 3, 0);
+ VERIFY( csz01 == 3 );
+
+ // size_type rfind(const char* s, size_type pos = 0) const;
+ csz01 = str01.rfind(str_lit01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str_lit01, 3);
+ VERIFY( csz01 == 0 );
+
+ // size_type rfind(char c, size_type pos = 0) const;
+ csz01 = str01.rfind('z');
+ csz02 = str01.size() - 1;
+ VERIFY( csz01 == csz02 );
+ csz01 = str01.rfind('/');
+ VERIFY( csz01 == npos );
+ return test;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// from tstring.cc, from jason merrill, et. al.
+
+// Copyright (C) 2000-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.4 basic_string::find_last_of
+bool test02()
+{
+ bool test __attribute__((unused)) = true;
+ std::string z("ab");
+ std::string::size_type pos;
+ pos = z.find_last_of("ab");
+ VERIFY( pos == 1 );
+ pos = z.find_last_of("Xa");
+ VERIFY( pos == 0 );
+ pos = z.find_last_of("Xb");
+ VERIFY( pos == 1 );
+ pos = z.find_last_of("XYZ");
+ VERIFY( pos == std::string::npos );
+ pos = z.find_last_of('a');
+ VERIFY( pos == 0 );
+ pos = z.find_last_of('b');
+ VERIFY( pos == 1 );
+ pos = z.find_last_of('X');
+ VERIFY( pos == std::string::npos );
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// from tstring.cc, from jason merrill, et. al.
+
+// Copyright (C) 2000-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.6 basic_string::find_last_not_of
+bool test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::string::size_type csize_type;
+ std::string::size_type pos;
+ csize_type npos = std::string::npos;
+
+ std::string x;
+ pos = x.find_last_not_of('X');
+ VERIFY( pos == npos );
+ pos = x.find_last_not_of("XYZ");
+ VERIFY( pos == npos );
+
+ std::string y("a");
+ pos = y.find_last_not_of('X');
+ VERIFY( pos == 0 );
+ pos = y.find_last_not_of('a');
+ VERIFY( pos == npos );
+ pos = y.find_last_not_of("XYZ");
+ VERIFY( pos == 0 );
+ pos = y.find_last_not_of("a");
+ VERIFY( pos == npos );
+
+ std::string z("ab");
+ pos = z.find_last_not_of('X');
+ VERIFY( pos == 1 );
+ pos = z.find_last_not_of("XYZ");
+ VERIFY( pos == 1 );
+ pos = z.find_last_not_of('b');
+ VERIFY( pos == 0 );
+ pos = z.find_last_not_of("Xb");
+ VERIFY( pos == 0 );
+ pos = z.find_last_not_of("Xa");
+ VERIFY( pos == 1 );
+ return test;
+}
+int main()
+{
+ test03();
+ return 0;
+}
--- /dev/null
+// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc)
+
+// Copyright (C) 2000-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.2 basic_string rfind
+bool test01(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::wstring::size_type csize_type;
+ typedef std::wstring::const_reference cref;
+ typedef std::wstring::reference ref;
+ csize_type npos = std::wstring::npos;
+ csize_type csz01, csz02;
+
+ const wchar_t str_lit01[] = L"mave";
+ const std::wstring str01(L"mavericks, santa cruz");
+ std::wstring str02(str_lit01);
+ std::wstring str03(L"s, s");
+ std::wstring str04;
+
+ // size_type rfind(const wstring&, size_type pos = 0) const;
+ csz01 = str01.rfind(str01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str01, 4);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str02,3);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str02);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str03);
+ VERIFY( csz01 == 8 );
+ csz01 = str01.rfind(str03, 3);
+ VERIFY( csz01 == npos );
+ csz01 = str01.rfind(str03, 12);
+ VERIFY( csz01 == 8 );
+
+ // An empty string consists of no characters
+ // therefore it should be found at every point in a string,
+ // except beyond the end
+ csz01 = str01.rfind(str04, 0);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str04, 5);
+ VERIFY( csz01 == 5 );
+ csz01 = str01.rfind(str04, str01.size());
+ VERIFY( csz01 == str01.size() );
+ csz01 = str01.rfind(str04, str01.size()+1);
+ VERIFY( csz01 == str01.size() );
+
+ // size_type rfind(const wchar_t* s, size_type pos, size_type n) const;
+ csz01 = str01.rfind(str_lit01, 0, 3);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str_lit01, 3, 0);
+ VERIFY( csz01 == 3 );
+
+ // size_type rfind(const wchar_t* s, size_type pos = 0) const;
+ csz01 = str01.rfind(str_lit01);
+ VERIFY( csz01 == 0 );
+ csz01 = str01.rfind(str_lit01, 3);
+ VERIFY( csz01 == 0 );
+
+ // size_type rfind(wchar_t c, size_type pos = 0) const;
+ csz01 = str01.rfind(L'z');
+ csz02 = str01.size() - 1;
+ VERIFY( csz01 == csz02 );
+ csz01 = str01.rfind(L'/');
+ VERIFY( csz01 == npos );
+ return test;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// from tstring.cc, from jason merrill, et. al.
+
+// Copyright (C) 2000-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.4 basic_string::find_last_of
+bool test02()
+{
+ bool test __attribute__((unused)) = true;
+ std::wstring::size_type pos;
+ std::wstring z(L"ab");
+ pos = z.find_last_of(L"ab");
+ VERIFY( pos == 1 );
+ pos = z.find_last_of(L"Xa");
+ VERIFY( pos == 0 );
+ pos = z.find_last_of(L"Xb");
+ VERIFY( pos == 1 );
+ pos = z.find_last_of(L"XYZ");
+ VERIFY( pos == std::wstring::npos );
+ pos = z.find_last_of(L'a');
+ VERIFY( pos == 0 );
+ pos = z.find_last_of(L'b');
+ VERIFY( pos == 1 );
+ pos = z.find_last_of(L'X');
+ VERIFY( pos == std::wstring::npos );
+ return test;
+}
+
+int main()
+{
+ test02();
+ return 0;
+}
--- /dev/null
+// from tstring.cc, from jason merrill, et. al.
+
+// Copyright (C) 2000-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <string>
+#include <testsuite_hooks.h>
+
+// 21.3.6.6 basic_string::find_last_not_of
+bool test03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::wstring::size_type csize_type;
+ std::wstring::size_type pos;
+ csize_type npos = std::wstring::npos;
+
+ std::wstring x;
+ pos = x.find_last_not_of(L'X');
+ VERIFY( pos == npos );
+ pos = x.find_last_not_of(L"XYZ");
+ VERIFY( pos == npos );
+
+ std::wstring y(L"a");
+ pos = y.find_last_not_of(L'X');
+ VERIFY( pos == 0 );
+ pos = y.find_last_not_of(L'a');
+ VERIFY( pos == npos );
+ pos = y.find_last_not_of(L"XYZ");
+ VERIFY( pos == 0 );
+ pos = y.find_last_not_of(L"a");
+ VERIFY( pos == npos );
+
+ std::wstring z(L"ab");
+ pos = z.find_last_not_of(L'X');
+ VERIFY( pos == 1 );
+ pos = z.find_last_not_of(L"XYZ");
+ VERIFY( pos == 1 );
+ pos = z.find_last_not_of(L'b');
+ VERIFY( pos == 0 );
+ pos = z.find_last_not_of(L"Xb");
+ VERIFY( pos == 0 );
+ pos = z.find_last_not_of(L"Xa");
+ VERIFY( pos == 1 );
+ return test;
+}
+int main()
+{
+ test03();
+ return 0;
+}
--- /dev/null
+// 1999-06-10 bkoz
+
+// Copyright (C) 1999-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.7 basic_string::substr
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::string::size_type csize_type;
+ typedef std::string::const_reference cref;
+ typedef std::string::reference ref;
+ csize_type csz01;
+
+ const char str_lit01[] = "rockaway, pacifica";
+ const std::string str01(str_lit01);
+ std::string str02;
+
+ // basic_string<charT, _Traits, _Alloc>
+ // substr(size_type pos = 0, size_type n = npos) const;
+ csz01 = str01.size();
+ str02 = str01.substr(0, 1);
+ VERIFY( str02 == "r" );
+ str02 = str01.substr(10);
+ VERIFY( str02 == "pacifica" );
+
+ try {
+ str02 = str01.substr(csz01 + 1);
+ VERIFY( false );
+ }
+ catch(std::out_of_range& fail) {
+ VERIFY( true );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+
+ try {
+ str02 = str01.substr(csz01);
+ VERIFY( str02.size() == 0 );
+ }
+ catch(std::out_of_range& fail) {
+ VERIFY( false );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+ return test;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
--- /dev/null
+// 1999-06-10 bkoz
+
+// Copyright (C) 1999-2013 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 21.3.6.7 basic_string::substr
+
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+bool test01(void)
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::wstring::size_type csize_type;
+ typedef std::wstring::const_reference cref;
+ typedef std::wstring::reference ref;
+ csize_type csz01;
+
+ const wchar_t str_lit01[] = L"rockaway, pacifica";
+ const std::wstring str01(str_lit01);
+ std::wstring str02;
+
+ // basic_string<charT, _Traits, _Alloc>
+ // substr(size_type pos = 0, size_type n = npos) const;
+ csz01 = str01.size();
+ str02 = str01.substr(0, 1);
+ VERIFY( str02 == L"r" );
+ str02 = str01.substr(10);
+ VERIFY( str02 == L"pacifica" );
+
+ try {
+ str02 = str01.substr(csz01 + 1);
+ VERIFY( false );
+ }
+ catch(std::out_of_range& fail) {
+ VERIFY( true );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+
+ try {
+ str02 = str01.substr(csz01);
+ VERIFY( str02.size() == 0 );
+ }
+ catch(std::out_of_range& fail) {
+ VERIFY( false );
+ }
+ catch(...) {
+ VERIFY( false );
+ }
+ return test;
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
+++ /dev/null
-// Copyright (C) 2004-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6 string operations
-
-#include <string>
-#include <testsuite_hooks.h>
-
-int test01(void)
-{
- bool test __attribute__((unused)) = true;
-
- std::wstring empty;
-
- // data() for size == 0 is non-NULL.
- VERIFY( empty.size() == 0 );
- const std::wstring::value_type* p = empty.data();
- VERIFY( p );
-
- return 0;
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc)
-
-// Copyright (C) 2000-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// 21.3.6.2 basic_string rfind
-bool test01(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::string::size_type csize_type;
- typedef std::string::const_reference cref;
- typedef std::string::reference ref;
- csize_type npos = std::string::npos;
- csize_type csz01, csz02;
-
- const char str_lit01[] = "mave";
- const std::string str01("mavericks, santa cruz");
- std::string str02(str_lit01);
- std::string str03("s, s");
- std::string str04;
-
- // size_type rfind(const string&, size_type pos = 0) const;
- csz01 = str01.rfind(str01);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str01, 4);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str02,3);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str02);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str03);
- VERIFY( csz01 == 8 );
- csz01 = str01.rfind(str03, 3);
- VERIFY( csz01 == npos );
- csz01 = str01.rfind(str03, 12);
- VERIFY( csz01 == 8 );
-
- // An empty string consists of no characters
- // therefore it should be found at every point in a string,
- // except beyond the end
- csz01 = str01.rfind(str04, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str04, 5);
- VERIFY( csz01 == 5 );
- csz01 = str01.rfind(str04, str01.size());
- VERIFY( csz01 == str01.size() );
- csz01 = str01.rfind(str04, str01.size()+1);
- VERIFY( csz01 == str01.size() );
-
- // size_type rfind(const char* s, size_type pos, size_type n) const;
- csz01 = str01.rfind(str_lit01, 0, 3);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str_lit01, 3, 0);
- VERIFY( csz01 == 3 );
-
- // size_type rfind(const char* s, size_type pos = 0) const;
- csz01 = str01.rfind(str_lit01);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str_lit01, 3);
- VERIFY( csz01 == 0 );
-
- // size_type rfind(char c, size_type pos = 0) const;
- csz01 = str01.rfind('z');
- csz02 = str01.size() - 1;
- VERIFY( csz01 == csz02 );
- csz01 = str01.rfind('/');
- VERIFY( csz01 == npos );
- return test;
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// from tstring.cc, from jason merrill, et. al.
-
-// Copyright (C) 2000-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// 21.3.6.4 basic_string::find_last_of
-bool test02()
-{
- bool test __attribute__((unused)) = true;
- std::string z("ab");
- std::string::size_type pos;
- pos = z.find_last_of("ab");
- VERIFY( pos == 1 );
- pos = z.find_last_of("Xa");
- VERIFY( pos == 0 );
- pos = z.find_last_of("Xb");
- VERIFY( pos == 1 );
- pos = z.find_last_of("XYZ");
- VERIFY( pos == std::string::npos );
- pos = z.find_last_of('a');
- VERIFY( pos == 0 );
- pos = z.find_last_of('b');
- VERIFY( pos == 1 );
- pos = z.find_last_of('X');
- VERIFY( pos == std::string::npos );
- return test;
-}
-
-int main()
-{
- test02();
- return 0;
-}
+++ /dev/null
-// from tstring.cc, from jason merrill, et. al.
-
-// Copyright (C) 2000-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// 21.3.6.6 basic_string::find_last_not_of
-bool test03()
-{
- bool test __attribute__((unused)) = true;
- typedef std::string::size_type csize_type;
- std::string::size_type pos;
- csize_type npos = std::string::npos;
-
- std::string x;
- pos = x.find_last_not_of('X');
- VERIFY( pos == npos );
- pos = x.find_last_not_of("XYZ");
- VERIFY( pos == npos );
-
- std::string y("a");
- pos = y.find_last_not_of('X');
- VERIFY( pos == 0 );
- pos = y.find_last_not_of('a');
- VERIFY( pos == npos );
- pos = y.find_last_not_of("XYZ");
- VERIFY( pos == 0 );
- pos = y.find_last_not_of("a");
- VERIFY( pos == npos );
-
- std::string z("ab");
- pos = z.find_last_not_of('X');
- VERIFY( pos == 1 );
- pos = z.find_last_not_of("XYZ");
- VERIFY( pos == 1 );
- pos = z.find_last_not_of('b');
- VERIFY( pos == 0 );
- pos = z.find_last_not_of("Xb");
- VERIFY( pos == 0 );
- pos = z.find_last_not_of("Xa");
- VERIFY( pos == 1 );
- return test;
-}
-int main()
-{
- test03();
- return 0;
-}
+++ /dev/null
-// 2000-06-22 -=dbv=- (shamelessy copied from bkoz' find.cc)
-
-// Copyright (C) 2000-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// 21.3.6.2 basic_string rfind
-bool test01(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::wstring::size_type csize_type;
- typedef std::wstring::const_reference cref;
- typedef std::wstring::reference ref;
- csize_type npos = std::wstring::npos;
- csize_type csz01, csz02;
-
- const wchar_t str_lit01[] = L"mave";
- const std::wstring str01(L"mavericks, santa cruz");
- std::wstring str02(str_lit01);
- std::wstring str03(L"s, s");
- std::wstring str04;
-
- // size_type rfind(const wstring&, size_type pos = 0) const;
- csz01 = str01.rfind(str01);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str01, 4);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str02,3);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str02);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str03);
- VERIFY( csz01 == 8 );
- csz01 = str01.rfind(str03, 3);
- VERIFY( csz01 == npos );
- csz01 = str01.rfind(str03, 12);
- VERIFY( csz01 == 8 );
-
- // An empty string consists of no characters
- // therefore it should be found at every point in a string,
- // except beyond the end
- csz01 = str01.rfind(str04, 0);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str04, 5);
- VERIFY( csz01 == 5 );
- csz01 = str01.rfind(str04, str01.size());
- VERIFY( csz01 == str01.size() );
- csz01 = str01.rfind(str04, str01.size()+1);
- VERIFY( csz01 == str01.size() );
-
- // size_type rfind(const wchar_t* s, size_type pos, size_type n) const;
- csz01 = str01.rfind(str_lit01, 0, 3);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str_lit01, 3, 0);
- VERIFY( csz01 == 3 );
-
- // size_type rfind(const wchar_t* s, size_type pos = 0) const;
- csz01 = str01.rfind(str_lit01);
- VERIFY( csz01 == 0 );
- csz01 = str01.rfind(str_lit01, 3);
- VERIFY( csz01 == 0 );
-
- // size_type rfind(wchar_t c, size_type pos = 0) const;
- csz01 = str01.rfind(L'z');
- csz02 = str01.size() - 1;
- VERIFY( csz01 == csz02 );
- csz01 = str01.rfind(L'/');
- VERIFY( csz01 == npos );
- return test;
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// from tstring.cc, from jason merrill, et. al.
-
-// Copyright (C) 2000-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// 21.3.6.4 basic_string::find_last_of
-bool test02()
-{
- bool test __attribute__((unused)) = true;
- std::wstring::size_type pos;
- std::wstring z(L"ab");
- pos = z.find_last_of(L"ab");
- VERIFY( pos == 1 );
- pos = z.find_last_of(L"Xa");
- VERIFY( pos == 0 );
- pos = z.find_last_of(L"Xb");
- VERIFY( pos == 1 );
- pos = z.find_last_of(L"XYZ");
- VERIFY( pos == std::wstring::npos );
- pos = z.find_last_of(L'a');
- VERIFY( pos == 0 );
- pos = z.find_last_of(L'b');
- VERIFY( pos == 1 );
- pos = z.find_last_of(L'X');
- VERIFY( pos == std::wstring::npos );
- return test;
-}
-
-int main()
-{
- test02();
- return 0;
-}
+++ /dev/null
-// from tstring.cc, from jason merrill, et. al.
-
-// Copyright (C) 2000-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-#include <string>
-#include <testsuite_hooks.h>
-
-// 21.3.6.6 basic_string::find_last_not_of
-bool test03()
-{
- bool test __attribute__((unused)) = true;
- typedef std::wstring::size_type csize_type;
- std::wstring::size_type pos;
- csize_type npos = std::wstring::npos;
-
- std::wstring x;
- pos = x.find_last_not_of(L'X');
- VERIFY( pos == npos );
- pos = x.find_last_not_of(L"XYZ");
- VERIFY( pos == npos );
-
- std::wstring y(L"a");
- pos = y.find_last_not_of(L'X');
- VERIFY( pos == 0 );
- pos = y.find_last_not_of(L'a');
- VERIFY( pos == npos );
- pos = y.find_last_not_of(L"XYZ");
- VERIFY( pos == 0 );
- pos = y.find_last_not_of(L"a");
- VERIFY( pos == npos );
-
- std::wstring z(L"ab");
- pos = z.find_last_not_of(L'X');
- VERIFY( pos == 1 );
- pos = z.find_last_not_of(L"XYZ");
- VERIFY( pos == 1 );
- pos = z.find_last_not_of(L'b');
- VERIFY( pos == 0 );
- pos = z.find_last_not_of(L"Xb");
- VERIFY( pos == 0 );
- pos = z.find_last_not_of(L"Xa");
- VERIFY( pos == 1 );
- return test;
-}
-int main()
-{
- test03();
- return 0;
-}
+++ /dev/null
-// 1999-06-10 bkoz
-
-// Copyright (C) 1999-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.7 basic_string::substr
-
-#include <string>
-#include <stdexcept>
-#include <testsuite_hooks.h>
-
-bool test01(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::string::size_type csize_type;
- typedef std::string::const_reference cref;
- typedef std::string::reference ref;
- csize_type csz01;
-
- const char str_lit01[] = "rockaway, pacifica";
- const std::string str01(str_lit01);
- std::string str02;
-
- // basic_string<charT, _Traits, _Alloc>
- // substr(size_type pos = 0, size_type n = npos) const;
- csz01 = str01.size();
- str02 = str01.substr(0, 1);
- VERIFY( str02 == "r" );
- str02 = str01.substr(10);
- VERIFY( str02 == "pacifica" );
-
- try {
- str02 = str01.substr(csz01 + 1);
- VERIFY( false );
- }
- catch(std::out_of_range& fail) {
- VERIFY( true );
- }
- catch(...) {
- VERIFY( false );
- }
-
- try {
- str02 = str01.substr(csz01);
- VERIFY( str02.size() == 0 );
- }
- catch(std::out_of_range& fail) {
- VERIFY( false );
- }
- catch(...) {
- VERIFY( false );
- }
- return test;
-}
-
-int main()
-{
- test01();
- return 0;
-}
+++ /dev/null
-// 1999-06-10 bkoz
-
-// Copyright (C) 1999-2013 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
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING3. If not see
-// <http://www.gnu.org/licenses/>.
-
-// 21.3.6.7 basic_string::substr
-
-#include <string>
-#include <stdexcept>
-#include <testsuite_hooks.h>
-
-bool test01(void)
-{
- bool test __attribute__((unused)) = true;
- typedef std::wstring::size_type csize_type;
- typedef std::wstring::const_reference cref;
- typedef std::wstring::reference ref;
- csize_type csz01;
-
- const wchar_t str_lit01[] = L"rockaway, pacifica";
- const std::wstring str01(str_lit01);
- std::wstring str02;
-
- // basic_string<charT, _Traits, _Alloc>
- // substr(size_type pos = 0, size_type n = npos) const;
- csz01 = str01.size();
- str02 = str01.substr(0, 1);
- VERIFY( str02 == L"r" );
- str02 = str01.substr(10);
- VERIFY( str02 == L"pacifica" );
-
- try {
- str02 = str01.substr(csz01 + 1);
- VERIFY( false );
- }
- catch(std::out_of_range& fail) {
- VERIFY( true );
- }
- catch(...) {
- VERIFY( false );
- }
-
- try {
- str02 = str01.substr(csz01);
- VERIFY( str02.size() == 0 );
- }
- catch(std::out_of_range& fail) {
- VERIFY( false );
- }
- catch(...) {
- VERIFY( false );
- }
- return test;
-}
-
-int main()
-{
- test01();
- return 0;
-}