2
0
mirror of https://github.com/boostorg/nowide.git synced 2026-02-21 15:12:30 +00:00
Files
nowide/test/test.hpp
Alexander Grund 7854435d8e Switch pointer alignment to left
Consistency with rest of boost
2020-01-07 21:27:26 +01:00

32 lines
1.3 KiB
C++

//
// Copyright (c) 2012 Artyom Beilis (Tonkikh)
// Copyright (c) 2019 Alexander Grund
//
// 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 BOOST_NOWIDE_LIB_TEST_H_INCLUDED
#define BOOST_NOWIDE_LIB_TEST_H_INCLUDED
#include <sstream>
#include <stdexcept>
/// Function called when a test failed to be able set a breakpoint for debugging
inline void test_failed(const std::string& msg)
{
throw std::runtime_error(msg);
}
#define TEST(x) \
do \
{ \
if(x) \
break; \
std::ostringstream ss; \
ss << "Error " #x " in " << __FILE__ << ':' << __LINE__ << " " << __FUNCTION__; \
test_failed(ss.str()); \
} while(0)
#endif // #ifndef BOOST_NOWIDE_LIB_TEST_H_INCLUDED