+2006-02-24 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/utf8-pointer.c: Add tests for g_utf8_strlen().
+
+ * glib/gutf8.c: Fix boundary cases in g_utf8_strlen().
+ (#332435)
+
2006-02-23 Kjartan Maraas <kmaraas@gnome.org>
* tests/completion-test.c: (main): Plug leaks reported by
+2006-02-24 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/utf8-pointer.c: Add tests for g_utf8_strlen().
+
+ * glib/gutf8.c: Fix boundary cases in g_utf8_strlen().
+ (#332435)
+
2006-02-23 Kjartan Maraas <kmaraas@gnome.org>
* tests/completion-test.c: (main): Plug leaks reported by
+2006-02-24 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/utf8-pointer.c: Add tests for g_utf8_strlen().
+
+ * glib/gutf8.c: Fix boundary cases in g_utf8_strlen().
+ (#332435)
+
2006-02-23 Kjartan Maraas <kmaraas@gnome.org>
* tests/completion-test.c: (main): Plug leaks reported by
"asd fasdf asdf asdf asd fasfd as fdasfd asdf as fdas ffsd asfd as fdASASASAs D"
"Asfdsf sdfg sdfg dsfg dfg sdfgsdfgsdfgsdfg sdfgsdfg sdfg sdfg sdf gsdfg sdfg sd\n\nlalala\n";
+static void
+test_length (void)
+{
+ g_assert (g_utf8_strlen ("1234", -1) == 4);
+ g_assert (g_utf8_strlen ("1234", 0) == 0);
+ g_assert (g_utf8_strlen ("1234", 1) == 1);
+ g_assert (g_utf8_strlen ("1234", 2) == 2);
+ g_assert (g_utf8_strlen ("1234", 3) == 3);
+ g_assert (g_utf8_strlen ("1234", 4) == 4);
+ g_assert (g_utf8_strlen ("1234", 5) == 4);
+
+ g_assert (g_utf8_strlen (longline, -1) == 762);
+ g_assert (g_utf8_strlen (longline, strlen (longline)) == 762);
+ g_assert (g_utf8_strlen (longline, 1024) == 762);
+
+ g_assert (g_utf8_strlen (NULL, 0) == 0);
+
+ g_assert (g_utf8_strlen ("a\340\250\201c", -1) == 3);
+ g_assert (g_utf8_strlen ("a\340\250\201c", 1) == 1);
+ g_assert (g_utf8_strlen ("a\340\250\201c", 2) == 1);
+ g_assert (g_utf8_strlen ("a\340\250\201c", 3) == 1);
+ g_assert (g_utf8_strlen ("a\340\250\201c", 4) == 2);
+ g_assert (g_utf8_strlen ("a\340\250\201c", 5) == 3);
+}
+
int main (int argc, char *argv[])
{
test_utf8 (longline);
-
+ test_length ();
+
return 0;
}