mirror of
https://github.com/boostorg/algorithm.git
synced 2025-07-29 12:07:18 +02:00
Fixing some regression bugs, not directly linked to the library functionality
- Comeau does not know strdup - Comeau and intel report "\n" as a printable character (isprint('\n')==true) [SVN r22464]
This commit is contained in:
@ -16,56 +16,56 @@ import testing ;
|
|||||||
DEPENDS all : test ;
|
DEPENDS all : test ;
|
||||||
|
|
||||||
{
|
{
|
||||||
test-suite string_algo
|
test-suite string_algo
|
||||||
: [ run
|
: [ run
|
||||||
container_test.cpp
|
container_test.cpp
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
: container
|
: container
|
||||||
]
|
]
|
||||||
[ run
|
[ run
|
||||||
trim_test.cpp
|
trim_test.cpp
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
: trim
|
: trim
|
||||||
]
|
]
|
||||||
[ run
|
[ run
|
||||||
conv_test.cpp
|
conv_test.cpp
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
: conv
|
: conv
|
||||||
]
|
]
|
||||||
[ run
|
[ run
|
||||||
predicate_test.cpp
|
predicate_test.cpp
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
: predicate
|
: predicate
|
||||||
]
|
]
|
||||||
[ run
|
[ run
|
||||||
find_test.cpp
|
find_test.cpp
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
: find
|
: find
|
||||||
]
|
]
|
||||||
[ run
|
[ run
|
||||||
split_test.cpp
|
split_test.cpp
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
: split
|
: split
|
||||||
]
|
]
|
||||||
[ run
|
[ run
|
||||||
replace_test.cpp
|
replace_test.cpp
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
: replace
|
: replace
|
||||||
]
|
]
|
||||||
[ run
|
[ run
|
||||||
regex_test.cpp
|
regex_test.cpp
|
||||||
<lib>../../../regex/build/boost_regex
|
<lib>../../../regex/build/boost_regex
|
||||||
: :
|
: :
|
||||||
:
|
:
|
||||||
: regex
|
: regex
|
||||||
]
|
]
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#include <boost/test/included/test_exec_monitor.hpp>
|
#include <boost/test/included/test_exec_monitor.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string.h>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
#include <boost/algorithm/string/case_conv.hpp>
|
#include <boost/algorithm/string/case_conv.hpp>
|
||||||
#include <boost/test/test_tools.hpp>
|
#include <boost/test/test_tools.hpp>
|
||||||
|
|
||||||
@ -24,8 +24,13 @@ void conv_test()
|
|||||||
string str1("AbCdEfG 123 xxxYYYzZzZ");
|
string str1("AbCdEfG 123 xxxYYYzZzZ");
|
||||||
string str2("AbCdEfG 123 xxxYYYzZzZ");
|
string str2("AbCdEfG 123 xxxYYYzZzZ");
|
||||||
string str3("");
|
string str3("");
|
||||||
char* pch1=strdup("AbCdEfG 123 xxxYYYzZzZ");
|
const char pch[]="AbCdEfG 123 xxxYYYzZzZ";
|
||||||
char* pch2=strdup("AbCdEfG 123 xxxYYYzZzZ");
|
unsigned int pchlen=sizeof(pch);
|
||||||
|
|
||||||
|
char* pch1=new char[pchlen];
|
||||||
|
std::copy(pch, pch+pchlen, pch1);
|
||||||
|
char* pch2=new char[pchlen];
|
||||||
|
std::copy(pch, pch+pchlen, pch2);
|
||||||
|
|
||||||
// *** iterator tests *** //
|
// *** iterator tests *** //
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ void classification_test()
|
|||||||
TEST_CLASS( is_digit(), "1234567890", "abc" );
|
TEST_CLASS( is_digit(), "1234567890", "abc" );
|
||||||
TEST_CLASS( is_graph(), "123abc.,", " \t" );
|
TEST_CLASS( is_graph(), "123abc.,", " \t" );
|
||||||
TEST_CLASS( is_lower(), "abc", "Aasdf" );
|
TEST_CLASS( is_lower(), "abc", "Aasdf" );
|
||||||
TEST_CLASS( is_print(), "abs", "\nasdf" );
|
TEST_CLASS( is_print(), "abs", "\003\004asdf" );
|
||||||
TEST_CLASS( is_punct(), ".,;\"", "abc" );
|
TEST_CLASS( is_punct(), ".,;\"", "abc" );
|
||||||
TEST_CLASS( is_upper(), "ABC", "aBc" );
|
TEST_CLASS( is_upper(), "ABC", "aBc" );
|
||||||
TEST_CLASS( is_xdigit(), "ABC123", "XFD" );
|
TEST_CLASS( is_xdigit(), "ABC123", "XFD" );
|
||||||
|
@ -53,21 +53,26 @@ void sequence_traits_test()
|
|||||||
// Combine tests for all variants of the algorithm
|
// Combine tests for all variants of the algorithm
|
||||||
#define TEST_ALGO( Algo, Input, Params, Output ) \
|
#define TEST_ALGO( Algo, Input, Params, Output ) \
|
||||||
{\
|
{\
|
||||||
BOOST_CHECKPOINT( #Input );\
|
BOOST_CHECKPOINT( #Algo " - Copy" );\
|
||||||
\
|
\
|
||||||
string str1(Input);\
|
string str1(Input);\
|
||||||
\
|
\
|
||||||
/* Copy test */ \
|
/* Copy test */ \
|
||||||
BOOST_CHECK( Algo##_copy( str1, BOOST_PP_SEQ_ENUM( Params ) )==Output );\
|
BOOST_CHECK( Algo##_copy( str1, BOOST_PP_SEQ_ENUM( Params ) )==Output );\
|
||||||
\
|
\
|
||||||
|
BOOST_CHECKPOINT( #Algo " - Iterator" );\
|
||||||
/* Iterator test */\
|
/* Iterator test */\
|
||||||
string strout;\
|
string strout;\
|
||||||
Algo##_copy( back_inserter(strout), str1, BOOST_PP_SEQ_ENUM( Params ) );\
|
Algo##_copy( back_inserter(strout), str1, BOOST_PP_SEQ_ENUM( Params ) );\
|
||||||
BOOST_CHECK( strout==Output ); \
|
BOOST_CHECK( strout==Output ); \
|
||||||
\
|
\
|
||||||
/* In-place test */\
|
/* In-place test */\
|
||||||
|
BOOST_CHECKPOINT( #Algo " - Inplace(vector)" );\
|
||||||
vector<char> vec1( str1.begin(), str1.end() );\
|
vector<char> vec1( str1.begin(), str1.end() );\
|
||||||
|
\
|
||||||
|
BOOST_CHECKPOINT( #Algo " - Inplace(list)" );\
|
||||||
list<char> list1( str1.begin(), str1.end() );\
|
list<char> list1( str1.begin(), str1.end() );\
|
||||||
|
\
|
||||||
Algo( str1, BOOST_PP_SEQ_ENUM( Params ) ); \
|
Algo( str1, BOOST_PP_SEQ_ENUM( Params ) ); \
|
||||||
BOOST_CHECK( equals( str1, Output ) );\
|
BOOST_CHECK( equals( str1, Output ) );\
|
||||||
Algo( vec1, BOOST_PP_SEQ_ENUM( Params ) ); \
|
Algo( vec1, BOOST_PP_SEQ_ENUM( Params ) ); \
|
||||||
|
Reference in New Issue
Block a user