mirror of
https://github.com/boostorg/uuid.git
synced 2026-01-19 04:42:16 +00:00
Update test_uuid_from_string_2
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <boost/uuid/uuid.hpp>
|
#include <boost/uuid/uuid.hpp>
|
||||||
#include <boost/uuid/uuid_io.hpp>
|
#include <boost/uuid/uuid_io.hpp>
|
||||||
|
#include <boost/uuid/invalid_uuid.hpp>
|
||||||
#include <boost/core/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@@ -11,25 +12,19 @@ using namespace boost::uuids;
|
|||||||
|
|
||||||
template<class Ch> void test( Ch const* str, int pos, from_chars_error err )
|
template<class Ch> void test( Ch const* str, int pos, from_chars_error err )
|
||||||
{
|
{
|
||||||
std::string expected;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
detail::throw_invalid_uuid( pos, err );
|
|
||||||
}
|
|
||||||
catch( std::exception const& x )
|
|
||||||
{
|
|
||||||
expected = x.what();
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
uuid_from_string( str );
|
uuid_from_string( str );
|
||||||
BOOST_ERROR( "uuid_from_string failed to throw" );
|
BOOST_ERROR( "uuid_from_string failed to throw" );
|
||||||
}
|
}
|
||||||
catch( std::exception const& x )
|
catch( invalid_uuid const& x )
|
||||||
{
|
{
|
||||||
BOOST_TEST_EQ( expected, std::string( x.what() ) );
|
BOOST_TEST_EQ( x.position(), pos );
|
||||||
|
BOOST_TEST_EQ( static_cast<int>( x.error() ), static_cast<int>( err ) );
|
||||||
|
}
|
||||||
|
catch( std::exception const& /*x*/ )
|
||||||
|
{
|
||||||
|
BOOST_ERROR( "uuid_from_string failed to throw invalid_uuid" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user