Fix tests.
This commit is contained in:
1 parent
48828f085b
commit
cc30ecebfc
1 file changed
+4
-2
@@ -38,7 +38,7 @@ static void test_utf8_basic(void)
|
|||||||
string_init (s);
|
string_init (s);
|
||||||
|
|
||||||
/* Test internal encode + decode for all characters */
|
/* Test internal encode + decode for all characters */
|
||||||
for (string_unicode_t i = 0; i < 0x10ffff; i++) {
|
for (string_unicode_t i = 1; i < 0x10ffff; i++) {
|
||||||
if (i < 0xD800U || i > 0xDFFFU) {
|
if (i < 0xD800U || i > 0xDFFFU) {
|
||||||
string_it_t it;
|
string_it_t it;
|
||||||
char buf[5] = {0};
|
char buf[5] = {0};
|
||||||
@@ -48,6 +48,7 @@ static void test_utf8_basic(void)
|
|||||||
bool b = string_end_p(it);
|
bool b = string_end_p(it);
|
||||||
assert (b == false);
|
assert (b == false);
|
||||||
assert (it->u == i);
|
assert (it->u == i);
|
||||||
|
assert (string_get_cref(it) == i);
|
||||||
assert (*it->next_ptr == 0);
|
assert (*it->next_ptr == 0);
|
||||||
assert (stringi_utf8_length(buf) == 1);
|
assert (stringi_utf8_length(buf) == 1);
|
||||||
assert (stringi_utf8_valid_str_p(buf) == true);
|
assert (stringi_utf8_valid_str_p(buf) == true);
|
||||||
@@ -81,7 +82,8 @@ static void test_utf8_it(void)
|
|||||||
string_init(s);
|
string_init(s);
|
||||||
const unsigned int tab[] = { 45, 1458, 25623, 129, 24 };
|
const unsigned int tab[] = { 45, 1458, 25623, 129, 24 };
|
||||||
for(int i = 0; i < 5; i++)
|
for(int i = 0; i < 5; i++)
|
||||||
string_push_u (s, i);
|
string_push_u (s, tab[i]);
|
||||||
|
assert (string_length_u(s) == 5);
|
||||||
string_it_t it;
|
string_it_t it;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(string_it(it, s) ; !string_end_p(it); string_next(it), i++) {
|
for(string_it(it, s) ; !string_end_p(it); string_next(it), i++) {
|
||||||
|
|||||||
Reference in new issue
Block a user