Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 1 | // (C) Copyright Gennadiy Rozental 2001-2008. |
| 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$ |
| 9 | // |
| 10 | // Version : $Revision: 49312 $ |
| 11 | // |
| 12 | // Description : defines specific version of execution monitor used to managed |
| 13 | // run unit of test cases. Translates execution exception into error level |
| 14 | // *************************************************************************** |
| 15 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 16 | #ifndef NDNBOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER |
| 17 | #define NDNBOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 18 | |
| 19 | // Boost.Test |
| 20 | #include <ndnboost/test/execution_monitor.hpp> |
| 21 | #include <ndnboost/test/detail/fwd_decl.hpp> |
| 22 | #include <ndnboost/test/utils/trivial_singleton.hpp> |
| 23 | #include <ndnboost/test/utils/callback.hpp> |
| 24 | |
| 25 | #include <ndnboost/test/detail/suppress_warnings.hpp> |
| 26 | |
| 27 | //____________________________________________________________________________// |
| 28 | |
| 29 | namespace ndnboost { |
| 30 | |
| 31 | namespace unit_test { |
| 32 | |
| 33 | // ************************************************************************** // |
| 34 | // ************** unit_test_monitor ************** // |
| 35 | // ************************************************************************** // |
| 36 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 37 | class NDNBOOST_TEST_DECL unit_test_monitor_t : public singleton<unit_test_monitor_t>, public execution_monitor { |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 38 | public: |
| 39 | enum error_level { |
| 40 | test_fail = 1, |
| 41 | test_ok = 0, |
| 42 | constructor_error = -1, |
| 43 | unexpected_exception = -2, |
| 44 | os_exception = -3, |
| 45 | os_timeout = -4, |
| 46 | fatal_error = -5, // includes both system and user |
| 47 | destructor_error = -6 |
| 48 | }; |
| 49 | |
| 50 | static bool is_critical_error( error_level e ) { return e <= fatal_error; } |
| 51 | |
| 52 | // monitor method |
| 53 | error_level execute_and_translate( test_case const& ); |
| 54 | |
| 55 | private: |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 56 | NDNBOOST_TEST_SINGLETON_CONS( unit_test_monitor_t ); |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 59 | NDNBOOST_TEST_SINGLETON_INST( unit_test_monitor ) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 60 | |
| 61 | } // namespace unit_test |
| 62 | |
| 63 | } // namespace ndnboost |
| 64 | |
| 65 | //____________________________________________________________________________// |
| 66 | |
| 67 | #include <ndnboost/test/detail/enable_warnings.hpp> |
| 68 | |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 69 | #endif // NDNBOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER |