Fixing the test drivers to work with GCC 4.3

git-svn-id: http://svn.code.sf.net/p/utfcpp/code@96 a809a056-fc17-0410-9590-b4f493f8b08e

Conflicts:
	v2_0/test_drivers/regression_tests/r1_0Beta3/basic_functionality.h
This commit is contained in:
ntrifunovic 2009-07-28 00:40:12 +00:00 committed by King_DuckZ
parent 58ab95c963
commit 86423f6f50
2 changed files with 16 additions and 16 deletions

View file

@ -4,8 +4,8 @@ using namespace utf8;
// [ 1538338 ] unchecked::next does not work correctly for 4-byte sequences. // [ 1538338 ] unchecked::next does not work correctly for 4-byte sequences.
void id_1538338() void id_1538338()
{ {
char* four_bytes = "\xf0\x90\x8d\x86"; const char* four_bytes = "\xf0\x90\x8d\x86";
char* it = four_bytes; const char* it = four_bytes;
int cp = unchecked::next(it); int cp = unchecked::next(it);
check (cp == 0x10346); check (cp == 0x10346);
} }

View file

@ -1,4 +1,4 @@
#include <cstring>
#include <cassert> #include <cassert>
#include <vector> #include <vector>
#include "../../source/utf8.h" #include "../../source/utf8.h"
@ -24,13 +24,13 @@ int main()
//next //next
char* twochars = "\xe6\x97\xa5\xd1\x88"; const char* twochars = "\xe6\x97\xa5\xd1\x88";
char* w = twochars; const char* w = twochars;
int cp = next(w, twochars + 6); int cp = next(w, twochars + 6);
assert (cp == 0x65e5); assert (cp == 0x65e5);
assert (w == twochars + 3); assert (w == twochars + 3);
char* threechars = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88"; const char* threechars = "\xf0\x90\x8d\x86\xe6\x97\xa5\xd1\x88";
w = threechars; w = threechars;
cp = next(w, threechars + 9); cp = next(w, threechars + 9);
assert (cp == 0x10346); assert (cp == 0x10346);
@ -43,7 +43,7 @@ int main()
assert (w == threechars + 9); assert (w == threechars + 9);
//peek_next //peek_next
char* const cw = twochars; const char* const cw = twochars;
cp = peek_next(cw, cw + 6); cp = peek_next(cw, cw + 6);
assert (cp == 0x65e5); assert (cp == 0x65e5);
assert (cw == twochars); assert (cw == twochars);
@ -150,24 +150,24 @@ int main()
replace_invalid (invalid_sequence, invalid_sequence + sizeof(invalid_sequence), back_inserter(replace_invalid_result), '?'); replace_invalid (invalid_sequence, invalid_sequence + sizeof(invalid_sequence), back_inserter(replace_invalid_result), '?');
bvalid = is_valid(replace_invalid_result.begin(), replace_invalid_result.end()); bvalid = is_valid(replace_invalid_result.begin(), replace_invalid_result.end());
assert (bvalid); assert (bvalid);
char* fixed_invalid_sequence = "a????z"; const char* fixed_invalid_sequence = "a????z";
assert (std::equal(replace_invalid_result.begin(), replace_invalid_result.end(), fixed_invalid_sequence)); assert (std::equal(replace_invalid_result.begin(), replace_invalid_result.end(), fixed_invalid_sequence));
// iterator // iterator
utf8::iterator<char*> it(threechars, threechars, threechars + 9); utf8::iterator<const char*> it(threechars, threechars, threechars + 9);
utf8::iterator<char*> it2 = it; utf8::iterator<const char*> it2 = it;
assert (it2 == it); assert (it2 == it);
assert (*it == 0x10346); assert (*it == 0x10346);
assert (*(++it) == 0x65e5); assert (*(++it) == 0x65e5);
assert ((*it++) == 0x65e5); assert ((*it++) == 0x65e5);
assert (*it == 0x0448); assert (*it == 0x0448);
assert (it != it2); assert (it != it2);
utf8::iterator<char*> endit (threechars + 9, threechars, threechars + 9); utf8::iterator<const char*> endit (threechars + 9, threechars, threechars + 9);
assert (++it == endit); assert (++it == endit);
assert (*(--it) == 0x0448); assert (*(--it) == 0x0448);
assert ((*it--) == 0x0448); assert ((*it--) == 0x0448);
assert (*it == 0x65e5); assert (*it == 0x65e5);
assert (--it == utf8::iterator<char*>(threechars, threechars, threechars + 9)); assert (--it == utf8::iterator<const char*>(threechars, threechars, threechars + 9));
assert (*it == 0x10346); assert (*it == 0x10346);
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@ -270,20 +270,20 @@ int main()
assert (utf16_end == &utf16result[0] + 4); assert (utf16_end == &utf16result[0] + 4);
// iterator // iterator
utf8::unchecked::iterator<char*> un_it(threechars); utf8::unchecked::iterator<const char*> un_it(threechars);
utf8::unchecked::iterator<char*> un_it2 = un_it; utf8::unchecked::iterator<const char*> un_it2 = un_it;
assert (un_it2 == un_it); assert (un_it2 == un_it);
assert (*un_it == 0x10346); assert (*un_it == 0x10346);
assert (*(++un_it) == 0x65e5); assert (*(++un_it) == 0x65e5);
assert ((*un_it++) == 0x65e5); assert ((*un_it++) == 0x65e5);
assert (un_it != un_it2); assert (un_it != un_it2);
assert (*un_it == 0x0448); assert (*un_it == 0x0448);
utf8::unchecked::iterator<char*> un_endit (threechars + 9); utf8::unchecked::iterator<const char*> un_endit (threechars + 9);
assert (++un_it == un_endit); assert (++un_it == un_endit);
assert (*(--un_it) == 0x0448); assert (*(--un_it) == 0x0448);
assert ((*un_it--) == 0x0448); assert ((*un_it--) == 0x0448);
assert (*un_it == 0x65e5); assert (*un_it == 0x65e5);
assert (--un_it == utf8::unchecked::iterator<char*>(threechars)); assert (--un_it == utf8::unchecked::iterator<const char*>(threechars));
assert (*un_it == 0x10346); assert (*un_it == 0x10346);
} }