Files
assert/test/source_location_test3.cpp

41 lines
1.0 KiB
C++
Raw Normal View History

2021-09-19 03:37:51 +03:00
// Copyright 2020, 2021 Peter Dimov
2020-01-21 01:52:41 +02:00
// Distributed under the Boost Software License, Version 1.0.
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/assert/source_location.hpp>
#include <boost/core/lightweight_test.hpp>
#include <sstream>
int main()
{
2021-09-19 00:45:15 +03:00
{
boost::source_location loc;
BOOST_TEST_EQ( loc.to_string(), std::string( "(unknown source location)" ) );
}
2020-01-21 01:52:41 +02:00
{
boost::source_location loc;
std::ostringstream os;
os << loc;
BOOST_TEST_EQ( os.str(), std::string( "(unknown source location)" ) );
}
2021-09-19 00:45:15 +03:00
{
boost::source_location loc = BOOST_CURRENT_LOCATION;
BOOST_TEST_EQ( loc.to_string(), std::string( __FILE__ ) + ":26 in function '" + BOOST_CURRENT_FUNCTION + "'" );
}
2020-01-21 01:52:41 +02:00
{
boost::source_location loc = BOOST_CURRENT_LOCATION;
std::ostringstream os;
os << loc;
2021-09-19 00:45:15 +03:00
BOOST_TEST_EQ( os.str(), std::string( __FILE__ ) + ":31 in function '" + BOOST_CURRENT_FUNCTION + "'" );
2020-01-21 01:52:41 +02:00
}
return boost::report_errors();
}