From 70d0fe5faec916b5d27c1a83d3849ac2ac3a8e0a Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sun, 16 May 2010 12:42:38 +0000 Subject: Replaced :: with _ in several path names llvm-svn: 103906 --- .../string_append/initializer_list.pass.cpp | 26 +++++++ .../string_append/iterator.pass.cpp | 87 ++++++++++++++++++++++ .../string_append/pointer.pass.cpp | 42 +++++++++++ .../string_append/pointer_size.pass.cpp | 47 ++++++++++++ .../string_append/push_back.pass.cpp | 32 ++++++++ .../string_append/size_char.pass.cpp | 42 +++++++++++ .../string.modifiers/string_append/string.pass.cpp | 50 +++++++++++++ .../string_append/string_size_size.pass.cpp | 60 +++++++++++++++ 8 files changed, 386 insertions(+) create mode 100644 libcxx/test/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp create mode 100644 libcxx/test/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp create mode 100644 libcxx/test/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp create mode 100644 libcxx/test/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp create mode 100644 libcxx/test/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp create mode 100644 libcxx/test/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp create mode 100644 libcxx/test/strings/basic.string/string.modifiers/string_append/string.pass.cpp create mode 100644 libcxx/test/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp (limited to 'libcxx/test/strings/basic.string/string.modifiers/string_append') diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp new file mode 100644 index 00000000000..44690d7bcf1 --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_append/initializer_list.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// basic_string& append(initializer_list il); + +#include +#include + +int main() +{ +#ifdef _LIBCPP_MOVE + { + std::string s("123"); + s.append({'a', 'b', 'c'}); + assert(s == "123abc"); + } +#endif +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp new file mode 100644 index 00000000000..fc2acea4bc1 --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp @@ -0,0 +1,87 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// template +// basic_string& append(InputIterator first, InputIterator last); + +#include +#include + +#include "../../input_iterator.h" + +template +void +test(S s, It first, It last, S expected) +{ + s.append(first, last); + assert(s.__invariants()); + assert(s == expected); +} + +int main() +{ + typedef std::string S; + const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + test(S(), s, s, S()); + test(S(), s, s+1, S("A")); + test(S(), s, s+10, S("ABCDEFGHIJ")); + test(S(), s, s+52, S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345"), s, s, S("12345")); + test(S("12345"), s, s+1, S("12345A")); + test(S("12345"), s, s+10, S("12345ABCDEFGHIJ")); + test(S("12345"), s, s+52, S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("1234567890"), s, s, S("1234567890")); + test(S("1234567890"), s, s+1, S("1234567890A")); + test(S("1234567890"), s, s+10, S("1234567890ABCDEFGHIJ")); + test(S("1234567890"), s, s+52, S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345678901234567890"), s, s, S("12345678901234567890")); + test(S("12345678901234567890"), s, s+1, S("12345678901234567890""A")); + test(S("12345678901234567890"), s, s+10, S("12345678901234567890""ABCDEFGHIJ")); + test(S("12345678901234567890"), s, s+52, + S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S(), input_iterator(s), input_iterator(s), S()); + test(S(), input_iterator(s), input_iterator(s+1), S("A")); + test(S(), input_iterator(s), input_iterator(s+10), + S("ABCDEFGHIJ")); + test(S(), input_iterator(s), input_iterator(s+52), + S("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345"), input_iterator(s), input_iterator(s), + S("12345")); + test(S("12345"), input_iterator(s), input_iterator(s+1), + S("12345A")); + test(S("12345"), input_iterator(s), input_iterator(s+10), + S("12345ABCDEFGHIJ")); + test(S("12345"), input_iterator(s), input_iterator(s+52), + S("12345ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("1234567890"), input_iterator(s), input_iterator(s), + S("1234567890")); + test(S("1234567890"), input_iterator(s), input_iterator(s+1), + S("1234567890A")); + test(S("1234567890"), input_iterator(s), input_iterator(s+10), + S("1234567890ABCDEFGHIJ")); + test(S("1234567890"), input_iterator(s), input_iterator(s+52), + S("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); + + test(S("12345678901234567890"), input_iterator(s), input_iterator(s), + S("12345678901234567890")); + test(S("12345678901234567890"), input_iterator(s), input_iterator(s+1), + S("12345678901234567890""A")); + test(S("12345678901234567890"), input_iterator(s), input_iterator(s+10), + S("12345678901234567890""ABCDEFGHIJ")); + test(S("12345678901234567890"), input_iterator(s), input_iterator(s+52), + S("12345678901234567890""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp new file mode 100644 index 00000000000..63a9deb730c --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_append/pointer.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// basic_string& append(const charT* s); + +#include +#include +#include + +template +void +test(S s, const typename S::value_type* str, S expected) +{ + s.append(str); + assert(s.__invariants()); + assert(s == expected); +} + +int main() +{ + typedef std::string S; + test(S(), "", S()); + test(S(), "12345", S("12345")); + test(S(), "12345678901234567890", S("12345678901234567890")); + + test(S("12345"), "", S("12345")); + test(S("12345"), "12345", S("1234512345")); + test(S("12345"), "1234567890", S("123451234567890")); + + test(S("12345678901234567890"), "", S("12345678901234567890")); + test(S("12345678901234567890"), "12345", S("1234567890123456789012345")); + test(S("12345678901234567890"), "12345678901234567890", + S("1234567890123456789012345678901234567890")); +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp new file mode 100644 index 00000000000..8aea4b80bd9 --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_append/pointer_size.pass.cpp @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// basic_string& +// append(const charT* s, size_type n); + +#include +#include +#include + +template +void +test(S s, const typename S::value_type* str, typename S::size_type n, S expected) +{ + s.append(str, n); + assert(s.__invariants()); + assert(s == expected); +} + +int main() +{ + typedef std::string S; + test(S(), "", 0, S()); + test(S(), "12345", 3, S("123")); + test(S(), "12345", 4, S("1234")); + test(S(), "12345678901234567890", 0, S()); + test(S(), "12345678901234567890", 1, S("1")); + test(S(), "12345678901234567890", 3, S("123")); + test(S(), "12345678901234567890", 20, S("12345678901234567890")); + + test(S("12345"), "", 0, S("12345")); + test(S("12345"), "12345", 5, S("1234512345")); + test(S("12345"), "1234567890", 10, S("123451234567890")); + + test(S("12345678901234567890"), "", 0, S("12345678901234567890")); + test(S("12345678901234567890"), "12345", 5, S("1234567890123456789012345")); + test(S("12345678901234567890"), "12345678901234567890", 20, + S("1234567890123456789012345678901234567890")); +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp new file mode 100644 index 00000000000..e552a3c95d0 --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_append/push_back.pass.cpp @@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// void push_back(charT c) + +#include +#include + +template +void +test(S s, typename S::value_type c, S expected) +{ + s.push_back(c); + assert(s.__invariants()); + assert(s == expected); +} + +int main() +{ + typedef std::string S; + test(S(), 'a', S(1, 'a')); + test(S("12345"), 'a', S("12345a")); + test(S("12345678901234567890"), 'a', S("12345678901234567890a")); +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp new file mode 100644 index 00000000000..1c9a07ec9cf --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_append/size_char.pass.cpp @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// basic_string& +// append(size_type n, charT c); + +#include +#include + +template +void +test(S s, typename S::size_type n, typename S::value_type c, S expected) +{ + s.append(n, c); + assert(s.__invariants()); + assert(s == expected); +} + +int main() +{ + typedef std::string S; + test(S(), 0, 'a', S()); + test(S(), 1, 'a', S(1, 'a')); + test(S(), 10, 'a', S(10, 'a')); + test(S(), 100, 'a', S(100, 'a')); + + test(S("12345"), 0, 'a', S("12345")); + test(S("12345"), 1, 'a', S("12345a")); + test(S("12345"), 10, 'a', S("12345aaaaaaaaaa")); + + test(S("12345678901234567890"), 0, 'a', S("12345678901234567890")); + test(S("12345678901234567890"), 1, 'a', S("12345678901234567890a")); + test(S("12345678901234567890"), 10, 'a', S("12345678901234567890aaaaaaaaaa")); +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_append/string.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_append/string.pass.cpp new file mode 100644 index 00000000000..aa37380415f --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_append/string.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// basic_string& +// append(const basic_string& str); + +#include +#include + +template +void +test(S s, S str, S expected) +{ + s.append(str); + assert(s.__invariants()); + assert(s == expected); +} + +int main() +{ + typedef std::string S; + test(S(), S(), S()); + test(S(), S("12345"), S("12345")); + test(S(), S("1234567890"), S("1234567890")); + test(S(), S("12345678901234567890"), S("12345678901234567890")); + + test(S("12345"), S(), S("12345")); + test(S("12345"), S("12345"), S("1234512345")); + test(S("12345"), S("1234567890"), S("123451234567890")); + test(S("12345"), S("12345678901234567890"), S("1234512345678901234567890")); + + test(S("1234567890"), S(), S("1234567890")); + test(S("1234567890"), S("12345"), S("123456789012345")); + test(S("1234567890"), S("1234567890"), S("12345678901234567890")); + test(S("1234567890"), S("12345678901234567890"), S("123456789012345678901234567890")); + + test(S("12345678901234567890"), S(), S("12345678901234567890")); + test(S("12345678901234567890"), S("12345"), S("1234567890123456789012345")); + test(S("12345678901234567890"), S("1234567890"), S("123456789012345678901234567890")); + test(S("12345678901234567890"), S("12345678901234567890"), + S("1234567890123456789012345678901234567890")); +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp new file mode 100644 index 00000000000..25de33e4594 --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_append/string_size_size.pass.cpp @@ -0,0 +1,60 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// + +// basic_string& +// append(const basic_string& str, size_type pos, size_type n); + +#include +#include +#include + +template +void +test(S s, S str, typename S::size_type pos, typename S::size_type n, S expected) +{ + try + { + s.append(str, pos, n); + assert(s.__invariants()); + assert(pos <= str.size()); + assert(s == expected); + } + catch (std::out_of_range&) + { + assert(pos > str.size()); + } +} + +int main() +{ + typedef std::string S; + test(S(), S(), 0, 0, S()); + test(S(), S(), 1, 0, S()); + test(S(), S("12345"), 0, 3, S("123")); + test(S(), S("12345"), 1, 4, S("2345")); + test(S(), S("12345"), 3, 15, S("45")); + test(S(), S("12345"), 5, 15, S("")); + test(S(), S("12345"), 6, 15, S("not happening")); + test(S(), S("12345678901234567890"), 0, 0, S()); + test(S(), S("12345678901234567890"), 1, 1, S("2")); + test(S(), S("12345678901234567890"), 2, 3, S("345")); + test(S(), S("12345678901234567890"), 12, 13, S("34567890")); + test(S(), S("12345678901234567890"), 21, 13, S("not happening")); + + test(S("12345"), S(), 0, 0, S("12345")); + test(S("12345"), S("12345"), 2, 2, S("1234534")); + test(S("12345"), S("1234567890"), 0, 100, S("123451234567890")); + + test(S("12345678901234567890"), S(), 0, 0, S("12345678901234567890")); + test(S("12345678901234567890"), S("12345"), 1, 3, S("12345678901234567890234")); + test(S("12345678901234567890"), S("12345678901234567890"), 5, 10, + S("123456789012345678906789012345")); +} -- cgit v1.2.3