diff options
Diffstat (limited to 'libstdc++-v3/testsuite/testsuite_hooks.h')
-rw-r--r-- | libstdc++-v3/testsuite/testsuite_hooks.h | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/libstdc++-v3/testsuite/testsuite_hooks.h b/libstdc++-v3/testsuite/testsuite_hooks.h index 896bf1cbcae..698433582cf 100644 --- a/libstdc++-v3/testsuite/testsuite_hooks.h +++ b/libstdc++-v3/testsuite/testsuite_hooks.h @@ -30,7 +30,7 @@ // This file provides the following: // -// 1) VERIFY(), via DEBUG_ASSERT, from Brent Verner <brent@rcfile.org>. +// 1) VERIFY(), via _GLIBCXX_ASSERT, from Brent Verner <brent@rcfile.org>. // This file is included in the various testsuite programs to provide // #define(able) assert() behavior for debugging/testing. It may be // a suitable location for other furry woodland creatures as well. @@ -61,13 +61,12 @@ #include <bits/c++config.h> #include <bits/functexcept.h> #include <cstddef> -#ifdef DEBUG_ASSERT +#ifdef _GLIBCXX_ASSERT # include <cassert> # define VERIFY(fn) assert(fn) #else # define VERIFY(fn) test &= (fn) #endif -#include <list> #include <locale> #ifdef _GLIBCXX_HAVE_UNISTD_H # include <unistd.h> @@ -75,7 +74,7 @@ # define unlink(x) #endif -namespace __gnu_cxx_test +namespace __gnu_test { // All macros are defined in GLIBCXX_CONFIGURE_TESTSUITE and imported // from c++config.h @@ -100,8 +99,32 @@ namespace __gnu_cxx_test // Simple callback structure for variable numbers of tests (all with // same signature). Assume all unit tests are of the signature // void test01(); - typedef void (*test_func) (void); - typedef std::list<test_func> func_callback; + class func_callback + { + public: + typedef void (*test_type) (void); + + private: + int _M_size; + test_type _M_tests[15]; + + public: + func_callback(): _M_size(0) { }; + + int + size() const { return _M_size; } + + const test_type* + tests() const { return _M_tests; } + + void + push_back(test_type test) + { + _M_tests[_M_size] = test; + ++_M_size; + } + }; + // Run select unit tests after setting global locale. void @@ -127,16 +150,6 @@ namespace __gnu_cxx_test int i; }; - struct pod_unsigned_int - { - unsigned int i; - }; - - struct pod_long - { - unsigned long i; - }; - struct state { unsigned long l; @@ -157,7 +170,7 @@ namespace __gnu_cxx_test ~counter() { --count; } }; -#define assert_count(n) VERIFY(__gnu_cxx_test::counter::count == n) +#define assert_count(n) VERIFY(__gnu_test::counter::count == n) // A (static) class for counting copy constructors and possibly throwing an // exception on a desired count. @@ -310,7 +323,7 @@ namespace __gnu_cxx_test inline bool operator==(const copy_tracker& lhs, const copy_tracker& rhs) { return lhs.id() == rhs.id(); } -} // namespace __gnu_cxx_test +} // namespace __gnu_test namespace std { @@ -319,13 +332,13 @@ namespace std // char_traits specialization template<> - struct char_traits<__gnu_cxx_test::pod_char> + struct char_traits<__gnu_test::pod_char> { - typedef __gnu_cxx_test::pod_char char_type; - typedef __gnu_cxx_test::pod_int int_type; + typedef __gnu_test::pod_char char_type; + typedef __gnu_test::pod_int int_type; typedef long pos_type; typedef unsigned long off_type; - typedef __gnu_cxx_test::state state_type; + typedef __gnu_test::state state_type; static void assign(char_type& __c1, const char_type& __c2); |