|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81030 - in trunk/libs/unordered/test: exception helpers
From: dnljms_at_[hidden]
Date: 2012-10-20 20:20:09
Author: danieljames
Date: 2012-10-20 20:20:07 EDT (Sat, 20 Oct 2012)
New Revision: 81030
URL: http://svn.boost.org/trac/boost/changeset/81030
Log:
Unordered: Improved exception test thing.
Allows repetition of exception tests + separate running the tests so that
different tests types or configurations can be mixed up.
Text files modified:
trunk/libs/unordered/test/exception/assign_exception_tests.cpp | 3 ++-
trunk/libs/unordered/test/exception/constructor_exception_tests.cpp | 3 ++-
trunk/libs/unordered/test/exception/copy_exception_tests.cpp | 3 ++-
trunk/libs/unordered/test/exception/erase_exception_tests.cpp | 3 ++-
trunk/libs/unordered/test/exception/insert_exception_tests.cpp | 3 ++-
trunk/libs/unordered/test/exception/rehash_exception_tests.cpp | 4 ++--
trunk/libs/unordered/test/exception/swap_exception_tests.cpp | 3 ++-
trunk/libs/unordered/test/helpers/exception_test.hpp | 31 +++++++++++++++++++++++--------
8 files changed, 37 insertions(+), 16 deletions(-)
Modified: trunk/libs/unordered/test/exception/assign_exception_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/exception/assign_exception_tests.cpp (original)
+++ trunk/libs/unordered/test/exception/assign_exception_tests.cpp 2012-10-20 20:20:07 EDT (Sat, 20 Oct 2012)
@@ -105,7 +105,8 @@
assign_test5() : assign_base<T>(5, 60, 0, 0, 1.0, 0.1) {}
};
-RUN_EXCEPTION_TESTS(
+EXCEPTION_TESTS(
(self_assign_test1)(self_assign_test2)
(assign_test1)(assign_test2)(assign_test3)(assign_test4)(assign_test5),
CONTAINER_SEQ)
+RUN_TESTS()
\ No newline at end of file
Modified: trunk/libs/unordered/test/exception/constructor_exception_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/exception/constructor_exception_tests.cpp (original)
+++ trunk/libs/unordered/test/exception/constructor_exception_tests.cpp 2012-10-20 20:20:07 EDT (Sat, 20 Oct 2012)
@@ -159,7 +159,7 @@
}
};
-RUN_EXCEPTION_TESTS(
+EXCEPTION_TESTS(
(construct_test1)
(construct_test2)
(construct_test3)
@@ -174,3 +174,4 @@
(input_range_construct_test)
(copy_range_construct_test),
CONTAINER_SEQ)
+RUN_TESTS()
\ No newline at end of file
Modified: trunk/libs/unordered/test/exception/copy_exception_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/exception/copy_exception_tests.cpp (original)
+++ trunk/libs/unordered/test/exception/copy_exception_tests.cpp 2012-10-20 20:20:07 EDT (Sat, 20 Oct 2012)
@@ -64,6 +64,7 @@
}
};
-RUN_EXCEPTION_TESTS(
+EXCEPTION_TESTS(
(copy_test1)(copy_test2)(copy_test3)(copy_with_allocator_test),
CONTAINER_SEQ)
+RUN_TESTS()
\ No newline at end of file
Modified: trunk/libs/unordered/test/exception/erase_exception_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/exception/erase_exception_tests.cpp (original)
+++ trunk/libs/unordered/test/exception/erase_exception_tests.cpp 2012-10-20 20:20:07 EDT (Sat, 20 Oct 2012)
@@ -49,6 +49,7 @@
}
};
-RUN_EXCEPTION_TESTS(
+EXCEPTION_TESTS(
(erase_by_key_test1),
CONTAINER_SEQ)
+RUN_TESTS()
\ No newline at end of file
Modified: trunk/libs/unordered/test/exception/insert_exception_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/exception/insert_exception_tests.cpp (original)
+++ trunk/libs/unordered/test/exception/insert_exception_tests.cpp 2012-10-20 20:20:07 EDT (Sat, 20 Oct 2012)
@@ -243,4 +243,5 @@
#endif
-RUN_EXCEPTION_TESTS(ALL_TESTS, CONTAINER_SEQ)
+EXCEPTION_TESTS(ALL_TESTS, CONTAINER_SEQ)
+RUN_TESTS()
\ No newline at end of file
Modified: trunk/libs/unordered/test/exception/rehash_exception_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/exception/rehash_exception_tests.cpp (original)
+++ trunk/libs/unordered/test/exception/rehash_exception_tests.cpp 2012-10-20 20:20:07 EDT (Sat, 20 Oct 2012)
@@ -79,7 +79,7 @@
void run(T& x) const { x.rehash(0); }
};
-RUN_EXCEPTION_TESTS(
+EXCEPTION_TESTS(
(rehash_test0)(rehash_test1)(rehash_test2)(rehash_test3)(rehash_test4),
CONTAINER_SEQ)
-
+RUN_TESTS()
\ No newline at end of file
Modified: trunk/libs/unordered/test/exception/swap_exception_tests.cpp
==============================================================================
--- trunk/libs/unordered/test/exception/swap_exception_tests.cpp (original)
+++ trunk/libs/unordered/test/exception/swap_exception_tests.cpp 2012-10-20 20:20:07 EDT (Sat, 20 Oct 2012)
@@ -118,7 +118,8 @@
swap_test4() : swap_base<T>(10, 10, 1, 2) {}
};
-RUN_EXCEPTION_TESTS(
+EXCEPTION_TESTS(
(self_swap_test1)(self_swap_test2)
(swap_test1)(swap_test2)(swap_test3)(swap_test4),
CONTAINER_SEQ)
+RUN_TESTS()
\ No newline at end of file
Modified: trunk/libs/unordered/test/helpers/exception_test.hpp
==============================================================================
--- trunk/libs/unordered/test/helpers/exception_test.hpp (original)
+++ trunk/libs/unordered/test/helpers/exception_test.hpp 2012-10-20 20:20:07 EDT (Sat, 20 Oct 2012)
@@ -20,22 +20,37 @@
fixture, BOOST_STRINGIZE(test_func<type>)); \
} \
+# define UNORDERED_EXCEPTION_TEST_CASE_REPEAT(name, test_func, n, type) \
+ UNORDERED_AUTO_TEST(name) \
+ { \
+ for (unsigned i = 0; i < n; ++i) { \
+ test_func< type > fixture; \
+ ::test::lightweight::exception_safety( \
+ fixture, BOOST_STRINGIZE(test_func<type>)); \
+ } \
+ } \
+
+
# define UNORDERED_EPOINT_IMPL ::test::lightweight::epoint
#define UNORDERED_EXCEPTION_TEST_POSTFIX RUN_TESTS()
-#define RUN_EXCEPTION_TESTS(test_seq, param_seq) \
- BOOST_PP_SEQ_FOR_EACH_PRODUCT(RUN_EXCEPTION_TESTS_OP, \
- (test_seq)(param_seq)) \
- RUN_TESTS() \
+#define EXCEPTION_TESTS(test_seq, param_seq) \
+ BOOST_PP_SEQ_FOR_EACH_PRODUCT(EXCEPTION_TESTS_OP, \
+ (test_seq)((1))(param_seq))
+
+#define EXCEPTION_TESTS_REPEAT(n, test_seq, param_seq) \
+ BOOST_PP_SEQ_FOR_EACH_PRODUCT(EXCEPTION_TESTS_OP, \
+ (test_seq)((n))(param_seq))
-#define RUN_EXCEPTION_TESTS_OP(r, product) \
- UNORDERED_EXCEPTION_TEST_CASE( \
+#define EXCEPTION_TESTS_OP(r, product) \
+ UNORDERED_EXCEPTION_TEST_CASE_REPEAT( \
BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, product), \
- BOOST_PP_CAT(_, BOOST_PP_SEQ_ELEM(1, product)) \
+ BOOST_PP_CAT(_, BOOST_PP_SEQ_ELEM(2, product)) \
), \
BOOST_PP_SEQ_ELEM(0, product), \
- BOOST_PP_SEQ_ELEM(1, product) \
+ BOOST_PP_SEQ_ELEM(1, product), \
+ BOOST_PP_SEQ_ELEM(2, product) \
) \
#define UNORDERED_SCOPE(scope_name) \
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk