After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754924 - Improve test coverage of g_utf8_validate() by added known-length invocation
Improve test coverage of g_utf8_validate() by added known-length invocation
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: i18n
unspecified
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-09-12 15:33 UTC by Mikhail Zabaluev
Modified: 2015-09-13 17:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
glib/tests/utf8-validate: test known-length case along with null-terminated (1.33 KB, patch)
2015-09-12 15:33 UTC, Mikhail Zabaluev
committed Details | Review

Description Mikhail Zabaluev 2015-09-12 15:33:12 UTC
The majority of tests written for g_utf8_validate() test validation of
complete null-terminated strings with -1 given as the length parameter.
The known-length invocation mode is only exercised by the few test cases that
specify a non-negative string length. The code path that implements the
known-length case, however, is different from the one for null-terminated
validation. By making the test function also invoke g_utf8_validate() with
computed length of the string we make sure that both paths are exercised for
any sequences of interest.
Comment 1 Mikhail Zabaluev 2015-09-12 15:33:16 UTC
Created attachment 311215 [details] [review]
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.
Comment 2 Matthias Clasen 2015-09-13 05:59:34 UTC
Review of attachment 311215 [details] [review]:

Sure, that makes a lot of sense.
Comment 3 Matthias Clasen 2015-09-13 17:37:50 UTC
Attachment 311215 [details] pushed as 67c5bba - glib/tests/utf8-validate: test known-length case along with null-terminated