1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
// ---------------------------------------------------------------------------|
// Yuma Test Harness includes
// ---------------------------------------------------------------------------|
#include "test/support/nc-query-util/nc-query-utils.h"
// ---------------------------------------------------------------------------|
// STD Includes
// ---------------------------------------------------------------------------|
#include <boost/xpressive/xpressive.hpp>
#include <boost/lexical_cast.hpp>
// ---------------------------------------------------------------------------|
// Boost Test Framework
// ---------------------------------------------------------------------------|
#include <boost/test/unit_test.hpp>
// ---------------------------------------------------------------------------|
// Global namespace usage
// ---------------------------------------------------------------------------|
using namespace std;
// ---------------------------------------------------------------------------|
namespace YumaTest
{
// ---------------------------------------------------------------------------|
string extractMessageIdStr( const std::string& query )
{
using namespace boost::xpressive;
sregex re = sregex::compile( "message-id=\"(\\d+)\"" );
smatch what;
// find a whole word
BOOST_REQUIRE_MESSAGE( regex_search( query, what, re ),
"Invalid XML Query - No message-id!" );
return what[1];
}
// ---------------------------------------------------------------------------|
uint16_t extractMessageId( const std::string& query )
{
return boost::lexical_cast<uint16_t>( extractMessageIdStr( query ) );
}
}
|