/*============================================================================= Copyright (c) 2011-2018 Bolero MURAKAMI https://github.com/bolero-MURAKAMI/Sprout Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #ifndef TESTSPR_INCLUDE_MAIN_HPP #define TESTSPR_INCLUDE_MAIN_HPP #ifndef TESTSPR_CPP_INCLUDE #ifndef TESTSPR_TEST_FUNCTION # error undefined TESTSPR_TEST_FUNCTION #endif #include #include #include #include #include #include int main() { std::cout << "testspr exec(" << SPROUT_PP_STRINGIZE(TESTSPR_TEST_FUNCTION) << "):" << std::endl; try { TESTSPR_TEST_FUNCTION(); } catch (testspr::assertion_failed const& e) { std::cout << " testspr failed." << std::endl << " " << e.what() << std::endl ; return EXIT_FAILURE; } catch (std::exception const& e) { std::cout << " testspr failed for some reason." << std::endl << " exception handled:" << std::endl << " type = " << testspr::typename_of(e) << std::endl << " what = " << e.what() << std::endl ; return EXIT_FAILURE; } catch (...) { std::cout << " testspr failed for some reason." << std::endl << " exception handled:" << std::endl << " type = " << std::endl ; return EXIT_FAILURE; } std::cout << " testspr succeeded." << std::endl; } #endif #endif // #ifndef TESTSPR_INCLUDE_MAIN_HPP