20 #endif // defined(__sun) 22 #if defined(__BORLANDC__) 29 # pragma option -w-ccc 31 #endif // defined(__BORLANDC__) 33 #if defined(ASIO_MSVC) 34 # pragma warning (disable:4127) 35 # pragma warning (push) 36 # pragma warning (disable:4244) 37 # pragma warning (disable:4702) 38 #endif // defined(ASIO_MSVC) 40 #if !defined(ASIO_TEST_IOSTREAM) 41 # define ASIO_TEST_IOSTREAM std::cerr 42 #endif // !defined(ASIO_TEST_IOSTREAM) 49 static const char* name = 0;
78 return errors == 0 ? 0 : 1;
81 template <
void (*Test)()>
99 #if defined(ASIO_NO_EXCEPTIONS) 101 template <
typename T>
108 #endif // defined(ASIO_NO_EXCEPTIONS) 113 #define ASIO_CHECK(expr) \ 114 do { if (!(expr)) { \ 115 ASIO_TEST_IOSTREAM << __FILE__ << "(" << __LINE__ << "): " \ 116 << asio::detail::test_name() << ": " \ 117 << "check '" << #expr << "' failed" << std::endl; \ 118 ++asio::detail::test_errors(); \ 121 #define ASIO_CHECK_MESSAGE(expr, msg) \ 122 do { if (!(expr)) { \ 123 ASIO_TEST_IOSTREAM << __FILE__ << "(" << __LINE__ << "): " \ 124 << asio::detail::test_name() << ": " \ 125 << msg << std::endl; \ 126 ++asio::detail::test_errors(); \ 129 #define ASIO_WARN_MESSAGE(expr, msg) \ 130 do { if (!(expr)) { \ 131 ASIO_TEST_IOSTREAM << __FILE__ << "(" << __LINE__ << "): " \ 132 << asio::detail::test_name() << ": " \ 133 << msg << std::endl; \ 136 #define ASIO_ERROR(msg) \ 138 ASIO_TEST_IOSTREAM << __FILE__ << "(" << __LINE__ << "): " \ 139 << asio::detail::test_name() << ": " \ 140 << msg << std::endl; \ 141 ++asio::detail::test_errors(); \ 144 #define ASIO_TEST_SUITE(name, tests) \ 147 asio::detail::begin_test_suite(name); \ 149 return asio::detail::end_test_suite(name); \ 152 #define ASIO_TEST_CASE(test) \ 153 asio::detail::run_test<&test>(#test); 155 #define ASIO_COMPILE_TEST_CASE(test) \ 156 asio::detail::compile_test<&test>(#test); 162 #if defined(__GNUC__) && defined(_AIX) 165 int test_main(
int,
char**)
169 #endif // defined(__GNUC__) && defined(_AIX) 171 #if defined(ASIO_MSVC) 172 # pragma warning (pop) 173 #endif // defined(ASIO_MSVC) 175 #endif // UNIT_TEST_HPP
atomic_count & test_errors()
int end_test_suite(const char *name)
#define ASIO_TEST_IOSTREAM
void begin_test_suite(const char *name)
void run_test(const char *name)
const char *& test_name()
void compile_test(const char *name)
void throw_exception(const Exception &e)