summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2005-08-08 16:48:23 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2005-08-08 16:48:23 +0000
commiteb37812fbedeca48fea746cdfc2220d83d854ad4 (patch)
tree580de284e7450b7cc7750b1fe03cf4ac372492be
parentee7932f3070c52e8942fd9eb235ced0a459bb033 (diff)
downloadglib-eb37812fbedeca48fea746cdfc2220d83d854ad4.tar.gz
Add a test for endianness handling.
2005-08-08 Matthias Clasen <mclasen@redhat.com> * tests/convert-test.c: Add a test for endianness handling.
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.pre-2-105
-rw-r--r--ChangeLog.pre-2-125
-rw-r--r--ChangeLog.pre-2-85
-rw-r--r--tests/convert-test.c41
5 files changed, 61 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b4af0d763..d17cb9bb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-08-08 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/convert-test.c: Add a test for
+ endianness handling.
+
2005-08-08 Sunil Mohan Adapa <sunil@atc.tcs.co.in>
* configure.in: Added "te" to ALL_LINGUAS.
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index b4af0d763..d17cb9bb0 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,8 @@
+2005-08-08 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/convert-test.c: Add a test for
+ endianness handling.
+
2005-08-08 Sunil Mohan Adapa <sunil@atc.tcs.co.in>
* configure.in: Added "te" to ALL_LINGUAS.
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index b4af0d763..d17cb9bb0 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,8 @@
+2005-08-08 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/convert-test.c: Add a test for
+ endianness handling.
+
2005-08-08 Sunil Mohan Adapa <sunil@atc.tcs.co.in>
* configure.in: Added "te" to ALL_LINGUAS.
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index b4af0d763..d17cb9bb0 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,8 @@
+2005-08-08 Matthias Clasen <mclasen@redhat.com>
+
+ * tests/convert-test.c: Add a test for
+ endianness handling.
+
2005-08-08 Sunil Mohan Adapa <sunil@atc.tcs.co.in>
* configure.in: Added "te" to ALL_LINGUAS.
diff --git a/tests/convert-test.c b/tests/convert-test.c
index 3fd9b9ec9..3a762475d 100644
--- a/tests/convert-test.c
+++ b/tests/convert-test.c
@@ -96,12 +96,53 @@ test_one_half (void)
g_free (out);
}
+static void
+test_byte_order (void)
+{
+ gchar *in_be = "\xfe\xff\x03\x93"; /* capital gamma */
+ gchar *in_le = "\xff\xfe\x93\x03";
+ gchar *expected = "\xce\x93";
+ gchar *out;
+ gsize bytes_read = 0;
+ gsize bytes_written = 0;
+ GError *error = NULL;
+ int i;
+
+ out = g_convert (in_le, -1,
+ "UTF-8", "UTF-16",
+ &bytes_read, &bytes_written,
+ &error);
+
+ g_assert (error == NULL);
+ g_assert (bytes_read == 4);
+ g_assert (bytes_written == 2);
+ g_assert (strcmp (out, expected) == 0);
+ g_free (out);
+
+ out = g_convert (in_le, -1,
+ "UTF-8", "UTF-16",
+ &bytes_read, &bytes_written,
+ &error);
+
+ g_assert (error == NULL);
+ g_assert (bytes_read == 2);
+ g_assert (bytes_written == 2);
+ g_assert (strcmp (out, expected) == 0);
+ g_free (out);
+}
int
main (int argc, char *argv[])
{
test_iconv_state ();
test_one_half ();
+
+#if 0
+ /* this one currently fails due to
+ * https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=165368
+ */
+ test_byte_order ();
+#endif
return 0;
}