[857] | 1 | // (C) Copyright Gennadiy Rozental 2001-2005.
|
---|
| 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 : $RCSfile: results_collector.hpp,v $
|
---|
| 9 | //
|
---|
| 10 | // Version : $Revision: 1.1 $
|
---|
| 11 | //
|
---|
| 12 | // Description : defines class unit_test_result that is responsible for
|
---|
| 13 | // gathering test results and presenting this information to end-user
|
---|
| 14 | // ***************************************************************************
|
---|
| 15 |
|
---|
| 16 | #ifndef BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER
|
---|
| 17 | #define BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER
|
---|
| 18 |
|
---|
| 19 | // Boost.Test
|
---|
| 20 | #include <boost/test/test_observer.hpp>
|
---|
| 21 |
|
---|
| 22 | #include <boost/test/detail/global_typedef.hpp>
|
---|
| 23 | #include <boost/test/detail/fwd_decl.hpp>
|
---|
| 24 |
|
---|
| 25 | #include <boost/test/utils/trivial_singleton.hpp>
|
---|
| 26 | #include <boost/test/utils/class_properties.hpp>
|
---|
| 27 |
|
---|
| 28 | #include <boost/test/detail/suppress_warnings.hpp>
|
---|
| 29 |
|
---|
| 30 | //____________________________________________________________________________//
|
---|
| 31 |
|
---|
| 32 | namespace boost {
|
---|
| 33 |
|
---|
| 34 | namespace unit_test {
|
---|
| 35 |
|
---|
| 36 | // ************************************************************************** //
|
---|
| 37 | // ************** first failed assertion debugger hook ************** //
|
---|
| 38 | // ************************************************************************** //
|
---|
| 39 |
|
---|
| 40 | namespace {
|
---|
| 41 | inline void first_failed_assertion() {}
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | // ************************************************************************** //
|
---|
| 45 | // ************** test_results ************** //
|
---|
| 46 | // ************************************************************************** //
|
---|
| 47 |
|
---|
| 48 | class test_results {
|
---|
| 49 | public:
|
---|
| 50 | test_results();
|
---|
| 51 |
|
---|
| 52 | typedef BOOST_READONLY_PROPERTY( counter_t, (results_collector_t)(test_results)(results_collect_helper) ) counter_prop;
|
---|
| 53 | typedef BOOST_READONLY_PROPERTY( bool, (results_collector_t)(test_results)(results_collect_helper) ) bool_prop;
|
---|
| 54 |
|
---|
| 55 | counter_prop p_assertions_passed;
|
---|
| 56 | counter_prop p_assertions_failed;
|
---|
| 57 | counter_prop p_expected_failures;
|
---|
| 58 | counter_prop p_test_cases_passed;
|
---|
| 59 | counter_prop p_test_cases_failed;
|
---|
| 60 | counter_prop p_test_cases_skipped;
|
---|
| 61 | bool_prop p_aborted;
|
---|
| 62 | bool_prop p_skipped;
|
---|
| 63 |
|
---|
| 64 | // "conclusion" methods
|
---|
| 65 | bool passed() const;
|
---|
| 66 | int result_code() const;
|
---|
| 67 |
|
---|
| 68 | // collection helper
|
---|
| 69 | void operator+=( test_results const& );
|
---|
| 70 |
|
---|
| 71 | void clear();
|
---|
| 72 | };
|
---|
| 73 |
|
---|
| 74 | // ************************************************************************** //
|
---|
| 75 | // ************** results_collector ************** //
|
---|
| 76 | // ************************************************************************** //
|
---|
| 77 |
|
---|
| 78 | class results_collector_t : public test_observer, public singleton<results_collector_t> {
|
---|
| 79 | public:
|
---|
| 80 | // test_observer interface implementation
|
---|
| 81 | void test_start( counter_t test_cases_amount );
|
---|
| 82 | void test_finish();
|
---|
| 83 | void test_aborted();
|
---|
| 84 |
|
---|
| 85 | void test_unit_start( test_unit const& );
|
---|
| 86 | void test_unit_finish( test_unit const&, unsigned long elapsed );
|
---|
| 87 | void test_unit_skipped( test_unit const& );
|
---|
| 88 | void test_unit_aborted( test_unit const& );
|
---|
| 89 |
|
---|
| 90 | void assertion_result( bool passed );
|
---|
| 91 | void exception_caught( execution_exception const& );
|
---|
| 92 |
|
---|
| 93 | // results access
|
---|
| 94 | test_results const& results( test_unit_id ) const;
|
---|
| 95 |
|
---|
| 96 | private:
|
---|
| 97 | BOOST_TEST_SINGLETON_CONS( results_collector_t );
|
---|
| 98 | };
|
---|
| 99 |
|
---|
| 100 | BOOST_TEST_SINGLETON_INST( results_collector )
|
---|
| 101 |
|
---|
| 102 | } // namespace unit_test
|
---|
| 103 |
|
---|
| 104 | } // namespace boost
|
---|
| 105 |
|
---|
| 106 | //____________________________________________________________________________//
|
---|
| 107 |
|
---|
| 108 | #include <boost/test/detail/enable_warnings.hpp>
|
---|
| 109 |
|
---|
| 110 | // ***************************************************************************
|
---|
| 111 | // Revision History :
|
---|
| 112 | //
|
---|
| 113 | // $Log: results_collector.hpp,v $
|
---|
| 114 | // Revision 1.1 2005/02/20 08:27:06 rogeeff
|
---|
| 115 | // This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
|
---|
| 116 | //
|
---|
| 117 | // Revision 1.25 2005/02/01 08:59:29 rogeeff
|
---|
| 118 | // supplied_log_formatters split
|
---|
| 119 | // change formatters interface to simplify result interface
|
---|
| 120 | //
|
---|
| 121 | // Revision 1.24 2005/02/01 06:40:06 rogeeff
|
---|
| 122 | // copyright update
|
---|
| 123 | // old log entries removed
|
---|
| 124 | // minor stilistic changes
|
---|
| 125 | // depricated tools removed
|
---|
| 126 | //
|
---|
| 127 | // Revision 1.23 2005/01/30 03:23:06 rogeeff
|
---|
| 128 | // result_tracker class removed
|
---|
| 129 | // counter type renamed
|
---|
| 130 | //
|
---|
| 131 | // ***************************************************************************
|
---|
| 132 |
|
---|
| 133 | #endif // BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER
|
---|
| 134 |
|
---|