From 86423f6f504c376e284acb371aec30f47461a37e Mon Sep 17 00:00:00 2001 From: ntrifunovic Date: Tue, 28 Jul 2009 00:40:12 +0000 Subject: [PATCH] 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 --- .../r1_0Beta3/basic_functionality.h | 4 +-- test_drivers/smoke_test/test.cpp | 28 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test_drivers/regression_tests/r1_0Beta3/basic_functionality.h b/test_drivers/regression_tests/r1_0Beta3/basic_functionality.h index 40af658..20456ed 100644 --- a/test_drivers/regression_tests/r1_0Beta3/basic_functionality.h +++ b/test_drivers/regression_tests/r1_0Beta3/basic_functionality.h @@ -4,8 +4,8 @@ using namespace utf8; // [ 1538338 ] unchecked::next does not work correctly for 4-byte sequences. void id_1538338() { - char* four_bytes = "\xf0\x90\x8d\x86"; - char* it = four_bytes; + const char* four_bytes = "\xf0\x90\x8d\x86"; + const char* it = four_bytes; int cp = unchecked::next(it); check (cp == 0x10346); } diff --git a/test_drivers/smoke_test/test.cpp b/test_drivers/smoke_test/test.cpp index f454549..2f0c99c 100644 --- a/test_drivers/smoke_test/test.cpp +++ b/test_drivers/smoke_test/test.cpp @@ -1,4 +1,4 @@ - +#include #include #include #include "../../source/utf8.h" @@ -24,13 +24,13 @@ int main() //next - char* twochars = "\xe6\x97\xa5\xd1\x88"; - char* w = twochars; + const char* twochars = "\xe6\x97\xa5\xd1\x88"; + const char* w = twochars; int cp = next(w, twochars + 6); assert (cp == 0x65e5); 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; cp = next(w, threechars + 9); assert (cp == 0x10346); @@ -43,7 +43,7 @@ int main() assert (w == threechars + 9); //peek_next - char* const cw = twochars; + const char* const cw = twochars; cp = peek_next(cw, cw + 6); assert (cp == 0x65e5); assert (cw == twochars); @@ -150,24 +150,24 @@ int main() 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()); 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)); // iterator - utf8::iterator it(threechars, threechars, threechars + 9); - utf8::iterator it2 = it; + utf8::iterator it(threechars, threechars, threechars + 9); + utf8::iterator it2 = it; assert (it2 == it); assert (*it == 0x10346); assert (*(++it) == 0x65e5); assert ((*it++) == 0x65e5); assert (*it == 0x0448); assert (it != it2); - utf8::iterator endit (threechars + 9, threechars, threechars + 9); + utf8::iterator endit (threechars + 9, threechars, threechars + 9); assert (++it == endit); assert (*(--it) == 0x0448); assert ((*it--) == 0x0448); assert (*it == 0x65e5); - assert (--it == utf8::iterator(threechars, threechars, threechars + 9)); + assert (--it == utf8::iterator(threechars, threechars, threechars + 9)); assert (*it == 0x10346); ////////////////////////////////////////////////////////// @@ -270,20 +270,20 @@ int main() assert (utf16_end == &utf16result[0] + 4); // iterator - utf8::unchecked::iterator un_it(threechars); - utf8::unchecked::iterator un_it2 = un_it; + utf8::unchecked::iterator un_it(threechars); + utf8::unchecked::iterator un_it2 = un_it; assert (un_it2 == un_it); assert (*un_it == 0x10346); assert (*(++un_it) == 0x65e5); assert ((*un_it++) == 0x65e5); assert (un_it != un_it2); assert (*un_it == 0x0448); - utf8::unchecked::iterator un_endit (threechars + 9); + utf8::unchecked::iterator un_endit (threechars + 9); assert (++un_it == un_endit); assert (*(--un_it) == 0x0448); assert ((*un_it--) == 0x0448); assert (*un_it == 0x65e5); - assert (--un_it == utf8::unchecked::iterator(threechars)); + assert (--un_it == utf8::unchecked::iterator(threechars)); assert (*un_it == 0x10346); }