1 // (C) Copyright Gennadiy Rozental 2001-2014.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5
6 // See http://www.boost.org/libs/test for the library home page.
7 //
8 //!@file
9 //!@brief some trivial global typedefs
10 // ***************************************************************************
11
12 #ifndef BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER
13 #define BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER
14
15 #include <boost/test/utils/basic_cstring/basic_cstring.hpp>
16 #include <boost/test/detail/workaround.hpp>
17
18 #define BOOST_TEST_L( s ) ::boost::unit_test::const_string( s, sizeof( s ) - 1 )
19 #define BOOST_TEST_STRINGIZE( s ) BOOST_TEST_L( BOOST_STRINGIZE( s ) )
20 #define BOOST_TEST_EMPTY_STRING BOOST_TEST_L( "" )
21
22 #define BOOST_TEST_SCOPE_SETCOLOR( os, attr, color ) \
23 scope_setcolor const& sc = runtime_config::color_output() \
24 ? scope_setcolor( os, attr, color ) \
25 : scope_setcolor(); \
26 ut_detail::ignore_unused_variable_warning( sc ) \
27 /**/
28
29 #include <boost/test/detail/suppress_warnings.hpp>
30
31 //____________________________________________________________________________//
32
33 namespace boost {
34 namespace unit_test {
35
36 typedef unsigned long counter_t;
37
38 //____________________________________________________________________________//
39
40 enum report_level { INV_REPORT_LEVEL, CONFIRMATION_REPORT, SHORT_REPORT, DETAILED_REPORT, NO_REPORT };
41
42 //____________________________________________________________________________//
43
44 enum output_format { OF_INVALID,
45 OF_CLF, ///< compiler log format
46 OF_XML, ///< XML format for report and log,
47 OF_DOT ///< dot format for output content
48 };
49
50 //____________________________________________________________________________//
51
52 enum test_unit_type { TUT_CASE = 0x01, TUT_SUITE = 0x10, TUT_ANY = 0x11 };
53
54 //____________________________________________________________________________//
55
56 enum assertion_result { AR_FAILED, AR_PASSED, AR_TRIGGERED };
57
58 //____________________________________________________________________________//
59
60 typedef unsigned long test_unit_id;
61
62 const test_unit_id INV_TEST_UNIT_ID = 0xFFFFFFFF;
63 const test_unit_id MAX_TEST_CASE_ID = 0xFFFFFFFE;
64 const test_unit_id MIN_TEST_CASE_ID = 0x00010000;
65 const test_unit_id MAX_TEST_SUITE_ID = 0x0000FF00;
66 const test_unit_id MIN_TEST_SUITE_ID = 0x00000001;
67
68 //____________________________________________________________________________//
69
70 namespace ut_detail {
71
72 inline test_unit_type
test_id_2_unit_type(test_unit_id id)73 test_id_2_unit_type( test_unit_id id )
74 {
75 return (id & 0xFFFF0000) != 0 ? TUT_CASE : TUT_SUITE;
76 }
77
78 //____________________________________________________________________________//
79
80 // helper templates to prevent ODR violations
81 template<class T>
82 struct static_constant {
83 static T value;
84 };
85
86 template<class T>
87 T static_constant<T>::value;
88
89 //____________________________________________________________________________//
90
91 } // namespace ut_detail
92
93 } // namespace unit_test
94 } // namespace boost
95
96 //____________________________________________________________________________//
97
98 #include <boost/test/detail/enable_warnings.hpp>
99
100 #endif // BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER
101