mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-01 15:00:59 +02:00
Get rid of tabs in Boost.Algorithm tests
[SVN r79603]
This commit is contained in:
@ -19,127 +19,127 @@ Try ostream_iterators
|
|||||||
namespace ba = boost::algorithm;
|
namespace ba = boost::algorithm;
|
||||||
|
|
||||||
void test_short_input1 () {
|
void test_short_input1 () {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
||||||
catch ( const std::exception &ex ) { return; }
|
catch ( const std::exception &ex ) { return; }
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch std::exception in test_short_input1" );
|
BOOST_TEST_MESSAGE ( "Failed to catch std::exception in test_short_input1" );
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_short_input2 () {
|
void test_short_input2 () {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
||||||
catch ( const ba::hex_decode_error &ex ) { return; }
|
catch ( const ba::hex_decode_error &ex ) { return; }
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch ba::hex_decode_error in test_short_input2" );
|
BOOST_TEST_MESSAGE ( "Failed to catch ba::hex_decode_error in test_short_input2" );
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_short_input3 () {
|
void test_short_input3 () {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
||||||
catch ( const ba::not_enough_input &ex ) { return; }
|
catch ( const ba::not_enough_input &ex ) { return; }
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch ba::not_enough_input in test_short_input3" );
|
BOOST_TEST_MESSAGE ( "Failed to catch ba::not_enough_input in test_short_input3" );
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that the right thing is thrown
|
// Make sure that the right thing is thrown
|
||||||
void test_short_input4 () {
|
void test_short_input4 () {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
try { ba::unhex ( std::string ( "A" ), std::back_inserter(s)); }
|
||||||
catch ( const ba::non_hex_input &ex ) { BOOST_CHECK ( false ); }
|
catch ( const ba::non_hex_input &ex ) { BOOST_CHECK ( false ); }
|
||||||
catch ( const ba::not_enough_input &ex ) { return; }
|
catch ( const ba::not_enough_input &ex ) { return; }
|
||||||
catch ( ... ) { BOOST_CHECK ( false ); }
|
catch ( ... ) { BOOST_CHECK ( false ); }
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure that the right thing is thrown
|
||||||
|
void test_short_input5 () {
|
||||||
|
std::string s;
|
||||||
|
|
||||||
|
try { ba::unhex ( "A", std::back_inserter(s)); }
|
||||||
|
catch ( const ba::non_hex_input &ex ) { BOOST_CHECK ( false ); }
|
||||||
|
catch ( const ba::not_enough_input &ex ) { return; }
|
||||||
|
catch ( ... ) { BOOST_CHECK ( false ); }
|
||||||
|
BOOST_CHECK ( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void test_short_input () {
|
void test_short_input () {
|
||||||
// BOOST_TEST_MESSAGE ( "Short input tests for boost::algorithm::unhex" );
|
// BOOST_TEST_MESSAGE ( "Short input tests for boost::algorithm::unhex" );
|
||||||
test_short_input1 ();
|
test_short_input1 ();
|
||||||
test_short_input2 ();
|
test_short_input2 ();
|
||||||
test_short_input3 ();
|
test_short_input3 ();
|
||||||
test_short_input4 ();
|
test_short_input4 ();
|
||||||
}
|
test_short_input5 ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void test_nonhex_input1 () {
|
void test_nonhex_input1 () {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( "01234FG1234", std::back_inserter(s)); }
|
try { ba::unhex ( "01234FG1234", std::back_inserter(s)); }
|
||||||
catch ( const std::exception &ex ) {
|
catch ( const std::exception &ex ) {
|
||||||
BOOST_CHECK ( 'G' == *boost::get_error_info<ba::bad_char>(ex));
|
BOOST_CHECK ( 'G' == *boost::get_error_info<ba::bad_char>(ex));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch std::exception in test_nonhex_input1" );
|
catch ( ... ) {}
|
||||||
BOOST_CHECK ( false );
|
BOOST_TEST_MESSAGE ( "Failed to catch std::exception in test_nonhex_input1" );
|
||||||
}
|
BOOST_CHECK ( false );
|
||||||
|
}
|
||||||
|
|
||||||
void test_nonhex_input2 () {
|
void test_nonhex_input2 () {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( "012Z4FA1234", std::back_inserter(s)); }
|
try { ba::unhex ( "012Z4FA1234", std::back_inserter(s)); }
|
||||||
catch ( const ba::hex_decode_error &ex ) {
|
catch ( const ba::hex_decode_error &ex ) {
|
||||||
BOOST_CHECK ( 'Z' == *boost::get_error_info<ba::bad_char>(ex));
|
BOOST_CHECK ( 'Z' == *boost::get_error_info<ba::bad_char>(ex));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch ba::hex_decode_error in test_nonhex_input2" );
|
catch ( ... ) {}
|
||||||
BOOST_CHECK ( false );
|
BOOST_TEST_MESSAGE ( "Failed to catch ba::hex_decode_error in test_nonhex_input2" );
|
||||||
}
|
BOOST_CHECK ( false );
|
||||||
|
}
|
||||||
|
|
||||||
void test_nonhex_input3 () {
|
void test_nonhex_input3 () {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( "01234FA12Q4", std::back_inserter(s)); }
|
try { ba::unhex ( "01234FA12Q4", std::back_inserter(s)); }
|
||||||
catch ( const ba::non_hex_input &ex ) {
|
catch ( const ba::non_hex_input &ex ) {
|
||||||
BOOST_CHECK ( 'Q' == *boost::get_error_info<ba::bad_char>(ex));
|
BOOST_CHECK ( 'Q' == *boost::get_error_info<ba::bad_char>(ex));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch ba::non_hex_input in test_nonhex_input3" );
|
catch ( ... ) {}
|
||||||
BOOST_CHECK ( false );
|
BOOST_TEST_MESSAGE ( "Failed to catch ba::non_hex_input in test_nonhex_input3" );
|
||||||
}
|
BOOST_CHECK ( false );
|
||||||
|
}
|
||||||
// Make sure that the right thing is thrown
|
|
||||||
|
// Make sure that the right thing is thrown
|
||||||
void test_nonhex_input4 () {
|
void test_nonhex_input4 () {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
try { ba::unhex ( "P1234FA1234", std::back_inserter(s)); }
|
try { ba::unhex ( "P1234FA1234", std::back_inserter(s)); }
|
||||||
catch ( const ba::not_enough_input &ex ) { BOOST_CHECK ( false ); }
|
catch ( const ba::not_enough_input &ex ) { BOOST_CHECK ( false ); }
|
||||||
catch ( const ba::non_hex_input &ex ) { return; }
|
catch ( const ba::non_hex_input &ex ) { return; }
|
||||||
catch ( ... ) { BOOST_CHECK ( false ); }
|
catch ( ... ) { BOOST_CHECK ( false ); }
|
||||||
BOOST_CHECK ( false );
|
BOOST_CHECK ( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that the right thing is thrown
|
|
||||||
void test_nonhex_input5 () {
|
|
||||||
std::string s;
|
|
||||||
|
|
||||||
try { ba::unhex ( "012", std::back_inserter(s)); }
|
|
||||||
catch ( const ba::non_hex_input &ex ) {
|
|
||||||
BOOST_CHECK ( '\000' == *boost::get_error_info<ba::bad_char>(ex));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
BOOST_TEST_MESSAGE ( "Failed to catch ba::non_hex_input in test_nonhex_input4" );
|
|
||||||
BOOST_CHECK ( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_nonhex_input () {
|
void test_nonhex_input () {
|
||||||
// BOOST_TEST_MESSAGE ( "Non hex input tests for for boost::algorithm::unhex" );
|
// BOOST_TEST_MESSAGE ( "Non hex input tests for for boost::algorithm::unhex" );
|
||||||
test_nonhex_input1 ();
|
test_nonhex_input1 ();
|
||||||
test_nonhex_input2 ();
|
test_nonhex_input2 ();
|
||||||
test_nonhex_input3 ();
|
test_nonhex_input3 ();
|
||||||
test_nonhex_input4 ();
|
test_nonhex_input4 ();
|
||||||
test_nonhex_input5 ();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int test_main( int , char* [] )
|
int test_main( int , char* [] )
|
||||||
{
|
{
|
||||||
test_short_input ();
|
test_short_input ();
|
||||||
test_nonhex_input ();
|
test_nonhex_input ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user