Commit eb37812f authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Add a test for endianness handling.

2005-08-08  Matthias Clasen  <mclasen@redhat.com>

	* tests/convert-test.c: Add a test for
	endianness handling.
parent ee7932f3
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.
......
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.
......
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.
......
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.
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment