trompeloeil.hpp (1316B)
1 /* 2 * Trompeloeil C++ mocking framework 3 * 4 * Copyright Björn Fahller 2014-2019 5 * Copyright Etienne Barbier 2020 6 * 7 * Use, modification and distribution is subject to the 8 * Boost Software License, Version 1.0. (See accompanying 9 * file LICENSE_1_0.txt or copy at 10 * http://www.boost.org/LICENSE_1_0.txt) 11 * 12 * Project home: https://github.com/rollbear/trompeloeil 13 */ 14 15 16 #ifndef TROMPELOEIL_CRITERION_HPP_ 17 #define TROMPELOEIL_CRITERION_HPP_ 18 19 #ifndef CRITERION_H_ 20 #error "<criterion.h> must be included before <criterion/trompeloeil.hpp>" 21 #endif 22 23 #include "../trompeloeil.hpp" 24 25 namespace trompeloeil 26 { 27 template <> 28 inline void reporter<specialized>::send( 29 severity s, 30 char const *file, 31 unsigned long line, 32 const char* msg) 33 { 34 struct criterion_assert_stats cr_stat__; 35 cr_stat__.passed = false; 36 cr_stat__.file = file; 37 cr_stat__.line = line; 38 cr_stat__.message = msg; 39 if (s == severity::fatal) 40 { 41 criterion_send_assert(&cr_stat__); 42 CR_FAIL_ABORT_(); 43 } 44 else 45 { 46 criterion_send_assert(&cr_stat__); 47 CR_FAIL_CONTINUES_(); 48 } 49 } 50 51 template <> 52 inline void reporter<specialized>::sendOk( 53 const char* trompeloeil_mock_calls_done_correctly) 54 { 55 cri_asserts_passed_incr(); 56 } 57 } 58 59 60 61 #endif //TROMPELOEIL_CRITERION_HPP_