2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2016-02-25 09:48:28 +00:00
|
|
|
Copyright (c) 2011-2016 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
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)
|
|
|
|
=============================================================================*/
|
2012-05-19 09:46:38 +00:00
|
|
|
#ifndef TESTSPR_INCLUDE_MAIN_HPP
|
|
|
|
#define TESTSPR_INCLUDE_MAIN_HPP
|
|
|
|
|
|
|
|
#ifndef TESTSPR_CPP_INCLUDE
|
|
|
|
|
|
|
|
#ifndef TESTSPR_TEST_FUNCTION
|
|
|
|
# error undefined TESTSPR_TEST_FUNCTION
|
|
|
|
#endif
|
|
|
|
|
2013-09-26 13:43:57 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
#include <exception>
|
2012-05-19 09:46:38 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <sprout/preprocessor/stringize.hpp>
|
2013-09-26 13:43:57 +00:00
|
|
|
#include <testspr/assert.hpp>
|
|
|
|
#include <testspr/typeinfo.hpp>
|
2012-05-19 09:46:38 +00:00
|
|
|
|
|
|
|
int main() {
|
2013-09-26 13:43:57 +00:00
|
|
|
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 = <unknown>" << std::endl
|
|
|
|
;
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
std::cout << " testspr succeeded." << std::endl;
|
2012-05-19 09:46:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // #ifndef TESTSPR_INCLUDE_MAIN_HPP
|