Adding a regression test
git-svn-id: http://svn.code.sf.net/p/utfcpp/code@128 a809a056-fc17-0410-9590-b4f493f8b08e
This commit is contained in:
parent
1f37fef7d2
commit
b13a2054ce
2 changed files with 45 additions and 0 deletions
|
@ -22,6 +22,9 @@ inline void check_impl (bool condition, const char* file, int line)
|
|||
// Release 2.2.2
|
||||
#include "r2_2_2/basic_functionality.h"
|
||||
|
||||
// Release 2.3.1
|
||||
#include "r2_3_1/basic_functionality.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
// Release 1.0 Beta 1
|
||||
|
@ -44,4 +47,8 @@ int main()
|
|||
//r2_2_2/basic_functionality.h
|
||||
id_2852872();
|
||||
id_2857454();
|
||||
|
||||
// Release 2.3.1
|
||||
// r2_3_1/basic_functionality.h
|
||||
id_3414834();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#include "../../../source/utf8.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <iterator>
|
||||
|
||||
// [ 3414834 ] Testing unchecked::iterator< istreambuf_iterator< char > >
|
||||
void id_3414834()
|
||||
{
|
||||
typedef std::istreambuf_iterator< char > char_iterator;
|
||||
typedef utf8::unchecked::iterator< char_iterator > utf8_iterator;
|
||||
|
||||
std::string input = "The rain in Spain falls mainly on the plain.";
|
||||
//std::cout << input << std::endl;
|
||||
|
||||
std::string output;
|
||||
{
|
||||
std::vector< uint32_t > output_characters;
|
||||
{
|
||||
std::stringstream input_stream( input );
|
||||
utf8_iterator const input_terminator;
|
||||
for(
|
||||
utf8_iterator input_iterator( input_stream );
|
||||
input_iterator != input_terminator;
|
||||
++input_iterator
|
||||
) {
|
||||
output_characters.push_back( *input_iterator );
|
||||
}
|
||||
}
|
||||
|
||||
utf8::utf32to8( output_characters.begin(), output_characters.end(),
|
||||
std::back_inserter( output )
|
||||
);
|
||||
}
|
||||
//std::cout << output << std::endl;
|
||||
|
||||
check(output == input);
|
||||
}
|
||||
|
Loading…
Reference in a new issue