diff options
Diffstat (limited to 'libcxx/test/std')
28 files changed, 73 insertions, 1222 deletions
diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp index 484ed06247d..526bcee7fdc 100644 --- a/libcxx/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp +++ b/libcxx/test/std/containers/associative/map/map.modifiers/insert_or_assign.pass.cpp @@ -22,7 +22,6 @@ // template <class M> // iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj); // C++17 -#include <__config> #include <map> #include <cassert> #include <tuple> @@ -60,9 +59,6 @@ public: int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS - { // pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj); typedef std::map<int, Moveable> M; typedef std::pair<M::iterator, bool> R; @@ -186,7 +182,4 @@ int main() assert(r->first.get() == 3); // key assert(r->second.get() == 5); // value } - -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES }
\ No newline at end of file diff --git a/libcxx/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp b/libcxx/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp index 8e0dd7577bb..7144ed2c727 100644 --- a/libcxx/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp +++ b/libcxx/test/std/containers/associative/map/map.modifiers/try.emplace.pass.cpp @@ -22,7 +22,6 @@ // template <class... Args> // iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args); // C++17 -#include <__config> #include <map> #include <cassert> #include <tuple> @@ -58,9 +57,6 @@ public: int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES -#ifndef _LIBCPP_HAS_NO_VARIADICS - { // pair<iterator, bool> try_emplace(const key_type& k, Args&&... args); typedef std::map<int, Moveable> M; typedef std::pair<M::iterator, bool> R; @@ -183,7 +179,4 @@ int main() assert(r->first.get() == 3); // key assert(r->second.get() == 4); // value } - -#endif // _LIBCPP_HAS_NO_VARIADICS -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES } diff --git a/libcxx/test/std/containers/sequences/vector/const_value_type.pass.cpp b/libcxx/test/std/containers/sequences/vector/const_value_type.pass.cpp deleted file mode 100644 index e16e439dec4..00000000000 --- a/libcxx/test/std/containers/sequences/vector/const_value_type.pass.cpp +++ /dev/null @@ -1,22 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// vector<const int> v; // an extension - -#include <vector> -#include <type_traits> - -int main() -{ -#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS - std::vector<const int> v = {1, 2, 3}; -#endif -} diff --git a/libcxx/test/std/containers/sequences/vector/db_back.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_back.pass.cpp deleted file mode 100644 index 05f3d07712e..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_back.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Call back() on empty container. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c(1); - assert(c.back() == 0); - c.clear(); - assert(c.back() == 0); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c(1); - assert(c.back() == 0); - c.clear(); - assert(c.back() == 0); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_cback.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_cback.pass.cpp deleted file mode 100644 index 5eb1a353e8b..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_cback.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Call back() on empty const container. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - const C c; - assert(c.back() == 0); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - const C c; - assert(c.back() == 0); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_cfront.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_cfront.pass.cpp deleted file mode 100644 index 5e54da1d444..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_cfront.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Call front() on empty const container. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - const C c; - assert(c.front() == 0); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - const C c; - assert(c.front() == 0); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_cindex.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_cindex.pass.cpp deleted file mode 100644 index 133aa565282..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_cindex.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Index const vector out of bounds. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - const C c(1); - assert(c[0] == 0); - assert(c[1] == 0); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - const C c(1); - assert(c[0] == 0); - assert(c[1] == 0); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_front.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_front.pass.cpp deleted file mode 100644 index 388058fb315..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_front.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Call front() on empty container. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c(1); - assert(c.front() == 0); - c.clear(); - assert(c.front() == 0); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c(1); - assert(c.front() == 0); - c.clear(); - assert(c.front() == 0); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_index.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_index.pass.cpp deleted file mode 100644 index 1daf076da67..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_index.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Index vector out of bounds. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c(1); - assert(c[0] == 0); - c.clear(); - assert(c[0] == 0); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c(1); - assert(c[0] == 0); - c.clear(); - assert(c[0] == 0); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_iterators_2.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_iterators_2.pass.cpp deleted file mode 100644 index 2d43843067b..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_iterators_2.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Compare iterators from different containers with <. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c1; - C c2; - bool b = c1.begin() < c2.begin(); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c1; - C c2; - bool b = c1.begin() < c2.begin(); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_iterators_3.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_iterators_3.pass.cpp deleted file mode 100644 index 051d66c3339..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_iterators_3.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Subtract iterators from different containers. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c1; - C c2; - int i = c1.begin() - c2.begin(); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c1; - C c2; - int i = c1.begin() - c2.begin(); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_iterators_4.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_iterators_4.pass.cpp deleted file mode 100644 index 4c2aa628de1..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_iterators_4.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Index iterator out of bounds. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c(1); - C::iterator i = c.begin(); - assert(i[0] == 0); - assert(i[1] == 0); - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c(1); - C::iterator i = c.begin(); - assert(i[0] == 0); - assert(i[1] == 0); - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_iterators_5.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_iterators_5.pass.cpp deleted file mode 100644 index 1b1090499c2..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_iterators_5.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Add to iterator out of bounds. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c(1); - C::iterator i = c.begin(); - i += 1; - assert(i == c.end()); - i = c.begin(); - i += 2; - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c(1); - C::iterator i = c.begin(); - i += 1; - assert(i == c.end()); - i = c.begin(); - i += 2; - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_iterators_6.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_iterators_6.pass.cpp deleted file mode 100644 index 424bc939b13..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_iterators_6.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Decrement iterator prior to begin. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c(1); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - --i; - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c(1); - C::iterator i = c.end(); - --i; - assert(i == c.begin()); - --i; - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_iterators_7.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_iterators_7.pass.cpp deleted file mode 100644 index 72cdb10cbc8..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_iterators_7.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Increment iterator past end. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c(1); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - ++i; - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c(1); - C::iterator i = c.begin(); - ++i; - assert(i == c.end()); - ++i; - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/containers/sequences/vector/db_iterators_8.pass.cpp b/libcxx/test/std/containers/sequences/vector/db_iterators_8.pass.cpp deleted file mode 100644 index 7b898533197..00000000000 --- a/libcxx/test/std/containers/sequences/vector/db_iterators_8.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <vector> - -// Dereference non-dereferenceable iterator. - -#if _LIBCPP_DEBUG >= 1 - -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) - -#include <vector> -#include <cassert> -#include <iterator> -#include <exception> -#include <cstdlib> - -#include "min_allocator.h" - -int main() -{ - { - typedef int T; - typedef std::vector<T> C; - C c(1); - C::iterator i = c.end(); - T j = *i; - assert(false); - } -#if __cplusplus >= 201103L - { - typedef int T; - typedef std::vector<T, min_allocator<T>> C; - C c(1); - C::iterator i = c.end(); - T j = *i; - assert(false); - } -#endif -} - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/std/extensions/hash/specializations.pass.cpp b/libcxx/test/std/extensions/hash/specializations.pass.cpp deleted file mode 100644 index a222b1eb5c6..00000000000 --- a/libcxx/test/std/extensions/hash/specializations.pass.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// NOTE: Undefined __DEPRECATED to prevent this test from failing with -Werror -#undef __DEPRECATED -#include <assert.h> -#include <ext/hash_map> -#include <string> - -int main() -{ - char str[] = "test"; - assert(__gnu_cxx::hash<const char *>()("test") == - std::hash<std::string>()("test")); - assert(__gnu_cxx::hash<char *>()(str) == std::hash<std::string>()("test")); - assert(__gnu_cxx::hash<char>()(42) == 42); - assert(__gnu_cxx::hash<signed char>()(42) == 42); - assert(__gnu_cxx::hash<unsigned char>()(42) == 42); - assert(__gnu_cxx::hash<short>()(42) == 42); - assert(__gnu_cxx::hash<unsigned short>()(42) == 42); - assert(__gnu_cxx::hash<int>()(42) == 42); - assert(__gnu_cxx::hash<unsigned int>()(42) == 42); - assert(__gnu_cxx::hash<long>()(42) == 42); - assert(__gnu_cxx::hash<unsigned long>()(42) == 42); -} diff --git a/libcxx/test/std/extensions/hash_map/const_iterator.fail.cpp b/libcxx/test/std/extensions/hash_map/const_iterator.fail.cpp deleted file mode 100644 index e4c536e8f33..00000000000 --- a/libcxx/test/std/extensions/hash_map/const_iterator.fail.cpp +++ /dev/null @@ -1,18 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -#include <ext/hash_map> - -int main() -{ - __gnu_cxx::hash_map<int, int> m; - m[1] = 1; - const __gnu_cxx::hash_map<int, int> &cm = m; - cm.find(1)->second = 2; // error -} diff --git a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass index 27b8cfd85c9..5f5a859cb29 100644 --- a/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass +++ b/libcxx/test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass @@ -22,6 +22,7 @@ // Testing to make sure that the max length values are correctly inserted #include <iostream> +#include <cctype> #include <sstream> #include <cassert> diff --git a/libcxx/test/std/localization/locale.categories/__scan_keyword.pass.cpp b/libcxx/test/std/localization/locale.categories/__scan_keyword.pass.cpp deleted file mode 100644 index b33aab9a730..00000000000 --- a/libcxx/test/std/localization/locale.categories/__scan_keyword.pass.cpp +++ /dev/null @@ -1,118 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <locale> - -// Not a portable test - -// __scan_keyword -// Scans [__b, __e) until a match is found in the basic_strings range -// [__kb, __ke) or until it can be shown that there is no match in [__kb, __ke). -// __b will be incremented (visibly), consuming CharT until a match is found -// or proved to not exist. A keyword may be "", in which will match anything. -// If one keyword is a prefix of another, and the next CharT in the input -// might match another keyword, the algorithm will attempt to find the longest -// matching keyword. If the longer matching keyword ends up not matching, then -// no keyword match is found. If no keyword match is found, __ke is returned. -// Else an iterator pointing to the matching keyword is found. If more than -// one keyword matches, an iterator to the first matching keyword is returned. -// If on exit __b == __e, eofbit is set in __err. If __case_sensitive is false, -// __ct is used to force to lower case before comparing characters. -// Examples: -// Keywords: "a", "abb" -// If the input is "a", the first keyword matches and eofbit is set. -// If the input is "abc", no match is found and "ab" are consumed. -// -// template <class _InputIterator, class _ForwardIterator, class _Ctype> -// _ForwardIterator -// __scan_keyword(_InputIterator& __b, _InputIterator __e, -// _ForwardIterator __kb, _ForwardIterator __ke, -// const _Ctype& __ct, ios_base::iostate& __err, -// bool __case_sensitive = true); - -#include <locale> -#include <cassert> - -int main() -{ - const std::ctype<char>& ct = std::use_facet<std::ctype<char> >(std::locale::classic()); - std::ios_base::iostate err = std::ios_base::goodbit; - { - const char input[] = "a"; - const char* in = input; - std::string keys[] = {"a", "abb"}; - err = std::ios_base::goodbit; - std::string* k = std::__scan_keyword(in, input+sizeof(input)-1, - keys, keys+sizeof(keys)/sizeof(keys[0]), - ct, err); - assert(k - keys == 0); - assert(in == input+1); - assert(err == std::ios_base::eofbit); - } - { - const char input[] = "abc"; - const char* in = input; - std::string keys[] = {"a", "abb"}; - err = std::ios_base::goodbit; - std::string* k = std::__scan_keyword(in, input+sizeof(input)-1, - keys, keys+sizeof(keys)/sizeof(keys[0]), - ct, err); - assert(k - keys == 2); - assert(in == input+2); - assert(err == std::ios_base::failbit); - } - { - const char input[] = "abb"; - const char* in = input; - std::string keys[] = {"a", "abb"}; - err = std::ios_base::goodbit; - std::string* k = std::__scan_keyword(in, input+sizeof(input)-1, - keys, keys+sizeof(keys)/sizeof(keys[0]), - ct, err); - assert(k - keys == 1); - assert(in == input+3); - assert(err == std::ios_base::eofbit); - } - { - const char input[] = "Tue "; - const char* in = input; - std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"}; - err = std::ios_base::goodbit; - std::string* k = std::__scan_keyword(in, input+sizeof(input)-1, - keys, keys+sizeof(keys)/sizeof(keys[0]), - ct, err); - assert(k - keys == 2); - assert(in == input+3); - assert(err == std::ios_base::goodbit); - } - { - const char input[] = "tue "; - const char* in = input; - std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"}; - err = std::ios_base::goodbit; - std::string* k = std::__scan_keyword(in, input+sizeof(input)-1, - keys, keys+sizeof(keys)/sizeof(keys[0]), - ct, err); - assert(k - keys == 4); - assert(in == input+0); - assert(err == std::ios_base::failbit); - } - { - const char input[] = "tue "; - const char* in = input; - std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"}; - err = std::ios_base::goodbit; - std::string* k = std::__scan_keyword(in, input+sizeof(input)-1, - keys, keys+sizeof(keys)/sizeof(keys[0]), - ct, err, false); - assert(k - keys == 2); - assert(in == input+3); - assert(err == std::ios_base::goodbit); - } -} diff --git a/libcxx/test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp deleted file mode 100644 index 4a7f77ad5d9..00000000000 --- a/libcxx/test/std/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <locale> - -// class locale::facet -// { -// protected: -// explicit facet(size_t refs = 0); -// virtual ~facet(); -// facet(const facet&) = delete; -// void operator=(const facet&) = delete; -// }; - -// This test isn't portable - -#include <locale> -#include <cassert> - -struct my_facet - : public std::locale::facet -{ - static int count; - my_facet(unsigned refs = 0) - : std::locale::facet(refs) - {++count;} - - ~my_facet() {--count;} -}; - -int my_facet::count = 0; - -int main() -{ - my_facet* f = new my_facet; - f->__add_shared(); - assert(my_facet::count == 1); - f->__release_shared(); - assert(my_facet::count == 0); - f = new my_facet(1); - f->__add_shared(); - assert(my_facet::count == 1); - f->__release_shared(); - assert(my_facet::count == 1); - f->__release_shared(); - assert(my_facet::count == 0); -} diff --git a/libcxx/test/std/extensions/nothing_to_do.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.types/locale.facet/tested_elsewhere.pass.cpp index b58f5c55b64..b58f5c55b64 100644 --- a/libcxx/test/std/extensions/nothing_to_do.pass.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.types/locale.facet/tested_elsewhere.pass.cpp diff --git a/libcxx/test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp b/libcxx/test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp deleted file mode 100644 index 3233624d87b..00000000000 --- a/libcxx/test/std/localization/locales/locale/locale.types/locale.id/id.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// <locale> - -// class locale::id -// { -// public: -// id(); -// void operator=(const id&) = delete; -// id(const id&) = delete; -// }; - -// This test isn't portable - -#include <locale> -#include <cassert> - -std::locale::id id0; -std::locale::id id2; -std::locale::id id1; - -int main() -{ - long id = id0.__get(); - assert(id0.__get() == id+0); - assert(id0.__get() == id+0); - assert(id0.__get() == id+0); - assert(id1.__get() == id+1); - assert(id1.__get() == id+1); - assert(id1.__get() == id+1); - assert(id2.__get() == id+2); - assert(id2.__get() == id+2); - assert(id2.__get() == id+2); - assert(id0.__get() == id+0); - assert(id0.__get() == id+0); - assert(id0.__get() == id+0); - assert(id1.__get() == id+1); - assert(id1.__get() == id+1); - assert(id1.__get() == id+1); - assert(id2.__get() == id+2); - assert(id2.__get() == id+2); - assert(id2.__get() == id+2); -} diff --git a/libcxx/test/std/extensions/hash/specializations.fail.cpp b/libcxx/test/std/localization/locales/locale/locale.types/locale.id/tested_elsewhere.pass.cpp index 8eeffb5802e..b58f5c55b64 100644 --- a/libcxx/test/std/extensions/hash/specializations.fail.cpp +++ b/libcxx/test/std/localization/locales/locale/locale.types/locale.id/tested_elsewhere.pass.cpp @@ -7,11 +7,6 @@ // //===----------------------------------------------------------------------===// -#include <assert.h> -#include <ext/hash_map> -#include <string> - int main() { - assert(__gnu_cxx::hash<std::string>()(std::string()) == 0); // error } diff --git a/libcxx/test/std/strings/c.strings/cwchar.pass.cpp b/libcxx/test/std/strings/c.strings/cwchar.pass.cpp index 85b861017fd..780509c63a1 100644 --- a/libcxx/test/std/strings/c.strings/cwchar.pass.cpp +++ b/libcxx/test/std/strings/c.strings/cwchar.pass.cpp @@ -35,11 +35,8 @@ int main() std::tm *tm = 0; std::wint_t w = 0; ::FILE* fp = 0; -#ifdef __APPLE__ - __darwin_va_list va; -#else - __builtin_va_list va; -#endif + std::va_list va; + char* ns = 0; wchar_t* ws = 0; static_assert((std::is_same<decltype(std::fwprintf(fp, L"")), int>::value), ""); diff --git a/libcxx/test/std/thread/futures/futures.async/async.pass.cpp b/libcxx/test/std/thread/futures/futures.async/async.pass.cpp index 5b1a60cabf7..20c16e79821 100644 --- a/libcxx/test/std/thread/futures/futures.async/async.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.async/async.pass.cpp @@ -21,15 +21,22 @@ // future<typename result_of<F(Args...)>::type> // async(launch policy, F&& f, Args&&... args); + #include <future> +#include <atomic> #include <memory> #include <cassert> +#include "test_macros.h" + typedef std::chrono::high_resolution_clock Clock; typedef std::chrono::milliseconds ms; +std::atomic_bool invoked = ATOMIC_VAR_INIT(false); + int f0() { + invoked = true; std::this_thread::sleep_for(ms(200)); return 3; } @@ -38,23 +45,27 @@ int i = 0; int& f1() { + invoked = true; std::this_thread::sleep_for(ms(200)); return i; } void f2() { + invoked = true; std::this_thread::sleep_for(ms(200)); } std::unique_ptr<int> f3(int j) { + invoked = true; std::this_thread::sleep_for(ms(200)); return std::unique_ptr<int>(new int(j)); } std::unique_ptr<int> f4(std::unique_ptr<int>&& p) { + invoked = true; std::this_thread::sleep_for(ms(200)); return std::move(p); } @@ -65,136 +76,78 @@ void f5(int j) throw j; } -int main() -{ - { - std::future<int> f = std::async(f0); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future<int> f = std::async(std::launch::async, f0); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future<int> f = std::async(std::launch::any, f0); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future<int> f = std::async(std::launch::deferred, f0); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 > ms(100)); - } +template <class Ret, class CheckLamdba, class ...Args> +void test(CheckLamdba&& getAndCheckFn, bool IsDeferred, Args&&... args) { + // Reset global state. + invoked = false; - { - std::future<int&> f = std::async(f1); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(&f.get() == &i); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future<int&> f = std::async(std::launch::async, f1); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(&f.get() == &i); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future<int&> f = std::async(std::launch::any, f1); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(&f.get() == &i); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future<int&> f = std::async(std::launch::deferred, f1); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(&f.get() == &i); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 > ms(100)); - } + // Create the future and wait + std::future<Ret> f = std::async(std::forward<Args>(args)...); + std::this_thread::sleep_for(ms(300)); - { - std::future<void> f = std::async(f2); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - f.get(); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); - } - { - std::future<void> f = std::async(std::launch::async, f2); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - f.get(); - Clock::time_point t1 = Clock::now(); + // Check that deferred async's have not invoked the function. + assert(invoked == !IsDeferred); + + // Time the call to f.get() and check that the returned value matches + // what is expected. + Clock::time_point t0 = Clock::now(); + assert(getAndCheckFn(f)); + Clock::time_point t1 = Clock::now(); + + // If the async is deferred it should take more than 100ms, otherwise + // it should take less than 100ms. + if (IsDeferred) { + assert(t1-t0 > ms(100)); + } else { assert(t1-t0 < ms(100)); } +} + +int main() +{ + // The default launch policy is implementation defined. libc++ defines + // it to be std::launch::async. + bool DefaultPolicyIsDeferred = false; + bool DPID = DefaultPolicyIsDeferred; + + std::launch AnyPolicy = std::launch::async | std::launch::deferred; + LIBCPP_ASSERT(AnyPolicy == std::launch::any); + { - std::future<void> f = std::async(std::launch::any, f2); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - f.get(); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); + auto checkInt = [](std::future<int>& f) { return f.get() == 3; }; + test<int>(checkInt, DPID, f0); + test<int>(checkInt, false, std::launch::async, f0); + test<int>(checkInt, true, std::launch::deferred, f0); + test<int>(checkInt, DPID, AnyPolicy, f0); } { - std::future<void> f = std::async(std::launch::deferred, f2); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - f.get(); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 > ms(100)); + auto checkIntRef = [&](std::future<int&>& f) { return &f.get() == &i; }; + test<int&>(checkIntRef, DPID, f1); + test<int&>(checkIntRef, false, std::launch::async, f1); + test<int&>(checkIntRef, true, std::launch::deferred, f1); + test<int&>(checkIntRef, DPID, AnyPolicy, f1); } - { - std::future<std::unique_ptr<int>> f = std::async(f3, 3); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(*f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); + auto checkVoid = [](std::future<void>& f) { f.get(); return true; }; + test<void>(checkVoid, DPID, f2); + test<void>(checkVoid, false, std::launch::async, f2); + test<void>(checkVoid, true, std::launch::deferred, f2); + test<void>(checkVoid, DPID, std::launch::any, f2); } - { - std::future<std::unique_ptr<int>> f = - std::async(f4, std::unique_ptr<int>(new int(3))); - std::this_thread::sleep_for(ms(300)); - Clock::time_point t0 = Clock::now(); - assert(*f.get() == 3); - Clock::time_point t1 = Clock::now(); - assert(t1-t0 < ms(100)); + using Ret = std::unique_ptr<int>; + auto checkUPtr = [](std::future<Ret>& f) { return *f.get() == 3; }; + test<Ret>(checkUPtr, DPID, f3, 3); + test<Ret>(checkUPtr, DPID, f4, std::unique_ptr<int>(new int(3))); } - { std::future<void> f = std::async(f5, 3); std::this_thread::sleep_for(ms(300)); try { f.get(); assert (false); } catch ( int ex ) {} } - { std::future<void> f = std::async(std::launch::deferred, f5, 3); std::this_thread::sleep_for(ms(300)); try { f.get(); assert (false); } catch ( int ex ) {} } - } diff --git a/libcxx/test/std/thread/futures/futures.overview/launch.pass.cpp b/libcxx/test/std/thread/futures/futures.overview/launch.pass.cpp index da54f7ee673..bf75fe4fa2c 100644 --- a/libcxx/test/std/thread/futures/futures.overview/launch.pass.cpp +++ b/libcxx/test/std/thread/futures/futures.overview/launch.pass.cpp @@ -15,28 +15,30 @@ // { // async = 1, // deferred = 2, -// any = async | deferred +// any = async | deferred /* EXTENSION */ // }; #include <future> #include <cassert> +#include "test_macros.h" + int main() { #ifdef _LIBCPP_HAS_NO_STRONG_ENUMS - static_assert(static_cast<int>(std::launch::any) == + LIBCPP_STATIC_ASSERT(static_cast<int>(std::launch::any) == (static_cast<int>(std::launch::async) | static_cast<int>(std::launch::deferred)), ""); #else - static_assert(std::launch::any == (std::launch::async | std::launch::deferred), ""); + LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async | std::launch::deferred), ""); static_assert(std::launch(0) == (std::launch::async & std::launch::deferred), ""); - static_assert(std::launch::any == (std::launch::async ^ std::launch::deferred), ""); + LIBCPP_STATIC_ASSERT(std::launch::any == (std::launch::async ^ std::launch::deferred), ""); static_assert(std::launch::deferred == ~std::launch::async, ""); std::launch x = std::launch::async; x &= std::launch::deferred; assert(x == std::launch(0)); x = std::launch::async; x |= std::launch::deferred; - assert(x == std::launch::any); + LIBCPP_ASSERT(x == std::launch::any); x ^= std::launch::deferred; assert(x == std::launch::async); #endif diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp deleted file mode 100644 index 1c715e04970..00000000000 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/__has_operator_addressof.pass.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// type_traits - -// extension - -// template <typename _Tp> struct __has_operator_addressof - - -#include <type_traits> - -#ifndef _LIBCPP_HAS_NO_CONSTEXPR - -struct A -{ -}; - -struct B -{ - constexpr B* operator&() const; -}; - -struct D; - -struct C -{ - template <class U> - D operator,(U&&); -}; - -struct E -{ - constexpr C operator&() const; -}; - -struct F {}; -constexpr F* operator&(F const &) { return nullptr; } - -struct G {}; -constexpr G* operator&(G &&) { return nullptr; } - -struct H {}; -constexpr H* operator&(H const &&) { return nullptr; } - -struct J -{ - constexpr J* operator&() const &&; -}; - -#endif // _LIBCPP_HAS_NO_CONSTEXPR - -int main() -{ -#ifndef _LIBCPP_HAS_NO_CONSTEXPR - static_assert(std::__has_operator_addressof<int>::value == false, ""); - static_assert(std::__has_operator_addressof<A>::value == false, ""); - static_assert(std::__has_operator_addressof<B>::value == true, ""); - static_assert(std::__has_operator_addressof<E>::value == true, ""); - static_assert(std::__has_operator_addressof<F>::value == true, ""); - static_assert(std::__has_operator_addressof<G>::value == true, ""); - static_assert(std::__has_operator_addressof<H>::value == true, ""); - static_assert(std::__has_operator_addressof<J>::value == true, ""); -#endif // _LIBCPP_HAS_NO_CONSTEXPR -} |