30bool IsUUID(
const std::string& aStr )
32 std::regex uuid(
"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" );
35 return std::regex_match( aStr, match, uuid );
42 const unsigned tsLen = 36;
43 const unsigned levelLen = tsLen + 1;
45 if( aStr.size() != aLevels * levelLen + 1 )
47 BOOST_TEST_INFO(
"String is the wrong length for " << aLevels <<
" levels." );
53 BOOST_TEST_INFO(
"Doesn't start with '/'" );
57 auto tsBegin = aStr.begin() + 1;
59 for(
unsigned i = 0; i < aLevels; i++ )
61 if( !
IsUUID( std::string( tsBegin, tsBegin + tsLen ) ) )
63 BOOST_TEST_INFO(
"Not a UUID at level "
64 << i <<
": " << std::string( tsBegin, tsBegin + tsLen ) );
68 if( *( tsBegin + tsLen ) !=
'/' )
70 BOOST_TEST_INFO(
"level doesn't end in '/'" );
bool IsUUIDPathWithLevels(const std::string &aStr, unsigned aLevels)
Predicate to check a string is a UUID path format.
bool IsUUID(const std::string &aStr)
Check if the string between the iterators looks like a UUID.
Test utilities for timestamps.