diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-06-22 08:01:27 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-06-22 08:01:27 +0000 |
commit | 3624fedb688eeb9e431f33b06f3b03a1b8c6bd31 (patch) | |
tree | 4a150f394ed07fb0daf4c41d3fb6c21a668e603c | |
parent | e357c0ad3b23900d7ba24a9688ee073c46f467ed (diff) | |
download | bcm5719-llvm-3624fedb688eeb9e431f33b06f3b03a1b8c6bd31.tar.gz bcm5719-llvm-3624fedb688eeb9e431f33b06f3b03a1b8c6bd31.zip |
Cleanup _LIBCPP_DEBUG tests in std::list. More to come.
llvm-svn: 273393
14 files changed, 122 insertions, 246 deletions
diff --git a/libcxx/test/std/containers/sequences/list/db_back.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/db_back.pass.cpp index a72aa319406..96dfd2d8d2e 100644 --- a/libcxx/test/std/containers/sequences/list/db_back.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/db_back.pass.cpp @@ -11,8 +11,7 @@ // Call back() on empty container. -#if _LIBCPP_DEBUG >= 1 - +#define _LIBCPP_DEBUG 1 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #include <list> @@ -21,11 +20,8 @@ #include <exception> #include <cstdlib> -#include "min_allocator.h" - int main() { - { typedef int T; typedef std::list<T> C; C c(1); @@ -33,24 +29,4 @@ int main() c.clear(); assert(c.back() == 0); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::list<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/list/db_cback.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/db_cback.pass.cpp index b3596f39a38..1e25307c460 100644 --- a/libcxx/test/std/containers/sequences/list/db_cback.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/db_cback.pass.cpp @@ -11,8 +11,7 @@ // Call back() on empty const container. -#if _LIBCPP_DEBUG >= 1 - +#define _LIBCPP_DEBUG 1 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #include <list> @@ -21,32 +20,11 @@ #include <exception> #include <cstdlib> -#include "min_allocator.h" - int main() { - { typedef int T; typedef std::list<T> C; const C c; assert(c.back() == 0); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::list<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/list/db_cfront.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/db_cfront.pass.cpp index 2aa866bed6e..9501ce19313 100644 --- a/libcxx/test/std/containers/sequences/list/db_cfront.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/db_cfront.pass.cpp @@ -11,8 +11,7 @@ // Call front() on empty const container. -#if _LIBCPP_DEBUG >= 1 - +#define _LIBCPP_DEBUG 1 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #include <list> @@ -21,32 +20,11 @@ #include <exception> #include <cstdlib> -#include "min_allocator.h" - int main() { - { typedef int T; typedef std::list<T> C; const C c; assert(c.front() == 0); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::list<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/list/db_front.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/db_front.pass.cpp index 560e49c5e20..fc02895a891 100644 --- a/libcxx/test/std/containers/sequences/list/db_front.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/db_front.pass.cpp @@ -11,8 +11,7 @@ // Call front() on empty container. -#if _LIBCPP_DEBUG >= 1 - +#define _LIBCPP_DEBUG 1 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #include <list> @@ -21,11 +20,8 @@ #include <exception> #include <cstdlib> -#include "min_allocator.h" - int main() { - { typedef int T; typedef std::list<T> C; C c(1); @@ -33,24 +29,4 @@ int main() c.clear(); assert(c.front() == 0); assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::list<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/list/db_iterators_6.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp index a97279d4358..3f0fd015e9a 100644 --- a/libcxx/test/std/containers/sequences/list/db_iterators_6.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/db_iterators_6.pass.cpp @@ -11,8 +11,7 @@ // Decrement iterator prior to begin. -#if _LIBCPP_DEBUG >= 1 - +#define _LIBCPP_DEBUG 1 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #include <list> @@ -21,11 +20,8 @@ #include <exception> #include <cstdlib> -#include "min_allocator.h" - int main() { - { typedef int T; typedef std::list<T> C; C c(1); @@ -34,25 +30,4 @@ int main() assert(i == c.begin()); --i; assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::list<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/list/db_iterators_7.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp index 0f653f01403..bc2b7f4e1da 100644 --- a/libcxx/test/std/containers/sequences/list/db_iterators_7.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/db_iterators_7.pass.cpp @@ -11,8 +11,7 @@ // Increment iterator past end. -#if _LIBCPP_DEBUG >= 1 - +#define _LIBCPP_DEBUG 1 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #include <list> @@ -21,11 +20,8 @@ #include <exception> #include <cstdlib> -#include "min_allocator.h" - int main() { - { typedef int T; typedef std::list<T> C; C c(1); @@ -34,25 +30,4 @@ int main() assert(i == c.end()); ++i; assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::list<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/list/db_iterators_8.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/db_iterators_8.pass.cpp index bec473cc49f..08c10d34a01 100644 --- a/libcxx/test/std/containers/sequences/list/db_iterators_8.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/db_iterators_8.pass.cpp @@ -11,8 +11,7 @@ // Dereference non-dereferenceable iterator. -#if _LIBCPP_DEBUG >= 1 - +#define _LIBCPP_DEBUG 1 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) #include <list> @@ -21,34 +20,12 @@ #include <exception> #include <cstdlib> -#include "min_allocator.h" - int main() { - { typedef int T; typedef std::list<T> C; C c(1); C::iterator i = c.end(); T j = *i; assert(false); - } -#if TEST_STD_VER >= 11 - { - typedef int T; - typedef std::list<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/containers/sequences/list/db_iterators_9.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp index 4e3abf335ce..e2b95d8b166 100644 --- a/libcxx/test/std/containers/sequences/list/db_iterators_9.pass.cpp +++ b/libcxx/test/libcxx/containers/sequences/list/db_iterators_9.pass.cpp @@ -7,13 +7,14 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03, c++11 +// UNSUPPORTED: c++98, c++03 +// UNSUPPORTED: libcpp-no-exceptions + // <list> // Operations on "NULL" iterators -#if _LIBCPP_DEBUG >= 1 - +#define _LIBCPP_DEBUG 1 #define _LIBCPP_ASSERT(x, m) do { if (!x) throw 1; } while(0) #include <list> @@ -56,11 +57,3 @@ int main() assert(lib_asserts == 4); } } - -#else - -int main() -{ -} - -#endif diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp new file mode 100644 index 00000000000..1d64f9bd9e2 --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/emplace_db1.pass.cpp @@ -0,0 +1,44 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// <list> + +// template <class... Args> void emplace(const_iterator p, Args&&... args); + +#define _LIBCPP_DEBUG 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include <list> +#include <cstdlib> +#include <cassert> + +class A +{ + int i_; + double d_; + + A(const A&); + A& operator=(const A&); +public: + A(int i, double d) + : i_(i), d_(d) {} + + int geti() const {return i_;} + double getd() const {return d_;} +}; + +int main() +{ + std::list<A> c1; + std::list<A> c2; + std::list<A>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5); + assert(false); +} diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp new file mode 100644 index 00000000000..0d0fd100fc9 --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/insert_iter_rvalue_db1.pass.cpp @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <list> + +// iterator insert(const_iterator position, value_type&& x); + +#define _LIBCPP_DEBUG 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include <list> +#include <cstdlib> +#include <cassert> + +int main() +{ + std::list<int> v1(3); + std::list<int> v2(3); + v1.insert(v2.begin(), 4); + assert(false); +}
\ No newline at end of file diff --git a/libcxx/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.pass.cpp new file mode 100644 index 00000000000..795e66d9702 --- /dev/null +++ b/libcxx/test/libcxx/containers/sequences/list/list.modifiers/pop_back_db1.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. +// +//===----------------------------------------------------------------------===// + +// <list> + +// void pop_back(); + +#define _LIBCPP_DEBUG 1 +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) + +#include <list> +#include <cstdlib> +#include <cassert> + +int main() +{ + int a[] = {1, 2, 3}; + std::list<int> c(a, a+3); + c.pop_back(); + assert(c == std::list<int>(a, a+2)); + c.pop_back(); + assert(c == std::list<int>(a, a+1)); + c.pop_back(); + assert(c.empty()); + c.pop_back(); // operation under test + assert(false); +} diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp index f3d2b86e723..e8d46941252 100644 --- a/libcxx/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/list.modifiers/emplace.pass.cpp @@ -7,17 +7,17 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <list> // template <class... Args> void emplace(const_iterator p, Args&&... args); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif #include <list> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" class A @@ -37,7 +37,6 @@ public: int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list<A> c; c.emplace(c.cbegin(), 2, 3.5); @@ -51,17 +50,6 @@ int main() assert(c.back().geti() == 3); assert(c.back().getd() == 4.5); } -#if _LIBCPP_DEBUG >= 1 - { - std::list<A> c1; - std::list<A> c2; - std::list<A>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if TEST_STD_VER >= 11 -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list<A, min_allocator<A>> c; c.emplace(c.cbegin(), 2, 3.5); @@ -75,14 +63,5 @@ int main() assert(c.back().geti() == 3); assert(c.back().getd() == 4.5); } -#if _LIBCPP_DEBUG >= 1 - { - std::list<A, min_allocator<A>> c1; - std::list<A, min_allocator<A>> c2; - std::list<A, min_allocator<A>>::iterator i = c1.emplace(c2.cbegin(), 2, 3.5); - assert(false); - } -#endif -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#endif + } diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp index c4fd129d95b..5d579fcd202 100644 --- a/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/list.modifiers/insert_iter_rvalue.pass.cpp @@ -7,14 +7,12 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: c++98, c++03 + // <list> // iterator insert(const_iterator position, value_type&& x); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - #include <list> #include <cassert> @@ -23,7 +21,6 @@ int main() { -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list<MoveOnly> l1; l1.insert(l1.cend(), MoveOnly(1)); @@ -34,17 +31,6 @@ int main() assert(l1.front() == MoveOnly(2)); assert(l1.back() == MoveOnly(1)); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if _LIBCPP_DEBUG >= 1 - { - std::list<int> v1(3); - std::list<int> v2(3); - v1.insert(v2.begin(), 4); - assert(false); - } -#endif -#if TEST_STD_VER >= 11 -#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES { std::list<MoveOnly, min_allocator<MoveOnly>> l1; l1.insert(l1.cend(), MoveOnly(1)); @@ -55,14 +41,4 @@ int main() assert(l1.front() == MoveOnly(2)); assert(l1.back() == MoveOnly(1)); } -#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES -#if _LIBCPP_DEBUG >= 1 - { - std::list<int, min_allocator<int>> v1(3); - std::list<int, min_allocator<int>> v2(3); - v1.insert(v2.begin(), 4); - assert(false); - } -#endif -#endif } diff --git a/libcxx/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp b/libcxx/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp index 3eadbb43e9d..c5b0277c6ef 100644 --- a/libcxx/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/list.modifiers/pop_back.pass.cpp @@ -11,13 +11,10 @@ // void pop_back(); -#if _LIBCPP_DEBUG >= 1 -#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) -#endif - #include <list> #include <cassert> +#include "test_macros.h" #include "min_allocator.h" int main() @@ -31,10 +28,6 @@ int main() assert(c == std::list<int>(a, a+1)); c.pop_back(); assert(c.empty()); -#if _LIBCPP_DEBUG >= 1 - c.pop_back(); - assert(false); -#endif } #if TEST_STD_VER >= 11 { @@ -46,10 +39,6 @@ int main() assert((c == std::list<int, min_allocator<int>>(a, a+1))); c.pop_back(); assert(c.empty()); -#if _LIBCPP_DEBUG >= 1 - c.pop_back(); - assert(false); -#endif } #endif } |