mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
glib/tests/utf8-validate: test known-length case along with null-terminated
For all test cases where the text length is given as -1, also call g_utf8_validate() with the actual string length to exercise the known-length case. Unknown-length and known-length validation use different code paths, but most of the tests only exercised with unknown-length parameter. https://bugzilla.gnome.org/show_bug.cgi?id=754924
This commit is contained in:
parent
8ab28b448b
commit
67c5bbaf03
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "glib.h"
|
#include "glib.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define UNICODE_VALID(Char) \
|
#define UNICODE_VALID(Char) \
|
||||||
((Char) < 0x110000 && \
|
((Char) < 0x110000 && \
|
||||||
@ -281,6 +282,14 @@ do_test (gconstpointer d)
|
|||||||
|
|
||||||
g_assert (result == test->valid);
|
g_assert (result == test->valid);
|
||||||
g_assert (end - test->text == test->offset);
|
g_assert (end - test->text == test->offset);
|
||||||
|
|
||||||
|
if (test->max_len < 0)
|
||||||
|
{
|
||||||
|
result = g_utf8_validate (test->text, strlen (test->text), &end);
|
||||||
|
|
||||||
|
g_assert (result == test->valid);
|
||||||
|
g_assert (end - test->text == test->offset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user