diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-08 17:06:47 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-08 17:06:47 +0000 |
commit | 5f53fceff01558582fbd4c7bd7bd1dc9a4fbdb90 (patch) | |
tree | 0f548389e5b5a8203af77e1985b0d6faf5d1bc81 /libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal | |
parent | 35fd7bc7e099c0dfb82cc947219515bbc0b5ec0c (diff) | |
download | bcm5719-llvm-5f53fceff01558582fbd4c7bd7bd1dc9a4fbdb90.tar.gz bcm5719-llvm-5f53fceff01558582fbd4c7bd7bd1dc9a4fbdb90.zip |
test: Rename string_op+= to string_op_plus_equal. Windows git doesn't like it.
llvm-svn: 121265
Diffstat (limited to 'libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal')
4 files changed, 158 insertions, 0 deletions
diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp new file mode 100644 index 00000000000..8c27f3b812b --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/char.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <string> + +// basic_string<charT,traits,Allocator>& operator+=(charT c); + +#include <string> +#include <cassert> + +template <class S> +void +test(S s, typename S::value_type str, S expected) +{ + s += str; + assert(s.__invariants()); + assert(s == expected); +} + +int main() +{ + typedef std::string S; + test(S(), 'a', S("a")); + test(S("12345"), 'a', S("12345a")); + test(S("1234567890"), 'a', S("1234567890a")); + test(S("12345678901234567890"), 'a', S("12345678901234567890a")); +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp new file mode 100644 index 00000000000..f6d8eb24f63 --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/initializer_list.pass.cpp @@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <string> + +// basic_string& operator+=(initializer_list<charT> il); + +#include <string> +#include <cassert> + +int main() +{ +#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES + { + std::string s("123"); + s += {'a', 'b', 'c'}; + assert(s == "123abc"); + } +#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp new file mode 100644 index 00000000000..8760a48121f --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/pointer.pass.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <string> + +// basic_string<charT,traits,Allocator>& operator+=(const charT* s); + +#include <string> +#include <cassert> + +template <class S> +void +test(S s, const typename S::value_type* str, S expected) +{ + s += str; + assert(s.__invariants()); + assert(s == expected); +} + +int main() +{ + typedef std::string S; + test(S(), "", S()); + test(S(), "12345", S("12345")); + test(S(), "1234567890", S("1234567890")); + test(S(), "12345678901234567890", S("12345678901234567890")); + + test(S("12345"), "", S("12345")); + test(S("12345"), "12345", S("1234512345")); + test(S("12345"), "1234567890", S("123451234567890")); + test(S("12345"), "12345678901234567890", S("1234512345678901234567890")); + + test(S("1234567890"), "", S("1234567890")); + test(S("1234567890"), "12345", S("123456789012345")); + test(S("1234567890"), "1234567890", S("12345678901234567890")); + test(S("1234567890"), "12345678901234567890", S("123456789012345678901234567890")); + + test(S("12345678901234567890"), "", S("12345678901234567890")); + test(S("12345678901234567890"), "12345", S("1234567890123456789012345")); + test(S("12345678901234567890"), "1234567890", S("123456789012345678901234567890")); + test(S("12345678901234567890"), "12345678901234567890", + S("1234567890123456789012345678901234567890")); +} diff --git a/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp b/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp new file mode 100644 index 00000000000..e5f5fa2b7fc --- /dev/null +++ b/libcxx/test/strings/basic.string/string.modifiers/string_op_plus_equal/string.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <string> + +// basic_string<charT,traits,Allocator>& +// operator+=(const basic_string<charT,traits,Allocator>& str); + +#include <string> +#include <cassert> + +template <class S> +void +test(S s, S str, S expected) +{ + s += 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")); +} |