return; /* silently skip if CP1255 is not supported, see bug 467707 */
g_assert_no_error (error);
- g_assert (bytes_read == 5);
- g_assert (bytes_written == 10);
- g_assert (strcmp (out, expected) == 0);
+ g_assert_cmpint (bytes_read, ==, 5);
+ g_assert_cmpint (bytes_written, ==, 10);
+ g_assert_cmpstr (out, ==, expected);
g_free (out);
}
&error);
g_assert_no_error (error);
- g_assert (bytes_read == 2);
- g_assert (bytes_written == 1);
- g_assert (strcmp (out, "\xbd") == 0);
+ g_assert_cmpint (bytes_read, ==, 2);
+ g_assert_cmpint (bytes_written, ==, 1);
+ g_assert_cmpstr (out, ==, "\xbd");
g_free (out);
out = g_convert (in, -1,
&error);
g_assert_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE);
- g_assert (bytes_read == 0);
- g_assert (bytes_written == 0);
- g_assert (out == NULL);
+ g_assert_cmpint (bytes_read, ==, 0);
+ g_assert_cmpint (bytes_written, ==, 0);
+ g_assert_cmpstr (out, ==, NULL);
g_clear_error (&error);
g_free (out);
&error);
g_assert_no_error (error);
- g_assert (bytes_read == 2);
- g_assert (bytes_written == 1);
- g_assert (strcmp (out, "a") == 0);
+ g_assert_cmpint (bytes_read, ==, 2);
+ g_assert_cmpint (bytes_written, ==, 1);
+ g_assert_cmpstr (out, ==, "a");
g_free (out);
}
&error);
g_assert_no_error (error);
- g_assert (bytes_read == 4);
- g_assert (bytes_written == 2);
- g_assert (strcmp (out, expected) == 0);
+ g_assert_cmpint (bytes_read, ==, 4);
+ g_assert_cmpint (bytes_written, ==, 2);
+ g_assert_cmpstr (out, ==, expected);
g_free (out);
out = g_convert (in_le, sizeof (in_le),
&error);
g_assert_no_error (error);
- g_assert (bytes_read == 4);
- g_assert (bytes_written == 2);
- g_assert (strcmp (out, expected) == 0);
+ g_assert_cmpint (bytes_read, ==, 4);
+ g_assert_cmpint (bytes_written, ==, 2);
+ g_assert_cmpstr (out, ==, expected);
g_free (out);
}
/* check the fast conversion */
result = g_utf8_to_ucs4_fast (utf8, utf8_len, &items_written);
- g_assert (items_written == ucs4_len);
+ g_assert_cmpint (items_written, ==, ucs4_len);
g_assert (result);
for (i = 0; i <= items_written; i++)
g_assert (result[i] == ucs4[i]);
result2 = g_utf8_to_ucs4 (utf8, -1, &items_read2, &items_written2, &error2);
g_assert (error || items_read2 == items_read);
g_assert (error || items_written2 == items_written2);
- g_assert (!!result == !!result2);
- g_assert (!!error == !!error2);
+ g_assert_cmpint (!!result, ==, !!result2);
+ g_assert_cmpint (!!error, ==, !!error2);
if (result)
for (i = 0; i <= items_written; i++)
g_assert (result[i] == result2[i]);
if (error3 && error3->code == G_CONVERT_ERROR_PARTIAL_INPUT)
{
g_assert_no_error (error);
- g_assert (items_read == error_pos);
- g_assert (items_written == ucs4_len);
+ g_assert_cmpint (items_read, ==, error_pos);
+ g_assert_cmpint (items_written, ==, ucs4_len);
g_assert (result);
for (i = 0; i <= items_written; i++)
g_assert (result[i] == ucs4[i]);
{
g_assert (error != NULL);
g_assert (result == NULL);
- g_assert (items_read == error_pos);
+ g_assert_cmpint (items_read, ==, error_pos);
g_error_free (error);
g_assert (error3 != NULL);
else
{
g_assert_no_error (error);
- g_assert (items_read == utf8_len);
- g_assert (items_written == ucs4_len);
+ g_assert_cmpint (items_read, ==, utf8_len);
+ g_assert_cmpint (items_written, ==, ucs4_len);
g_assert (result);
for (i = 0; i <= items_written; i++)
g_assert (result[i] == ucs4[i]);
g_assert (error || items_read2 == items_read);
g_assert (error || items_written2 == items_written);
- g_assert (!!result == !!result2);
- g_assert (!!error == !!error2);
+ g_assert_cmpint (!!result, ==, !!result2);
+ g_assert_cmpint (!!error, ==, !!error2);
if (result)
- g_assert (strcmp (result, result2) == 0);
+ g_assert_cmpstr (result, ==, result2);
g_free (result2);
if (error2)
{
g_assert (error != NULL);
g_assert (result == NULL);
- g_assert (items_read == error_pos);
+ g_assert_cmpint (items_read, ==, error_pos);
g_error_free (error);
g_assert (error3 != NULL);
else
{
g_assert_no_error (error);
- g_assert (items_read == ucs4_len);
- g_assert (items_written == utf8_len);
+ g_assert_cmpint (items_read, ==, ucs4_len);
+ g_assert_cmpint (items_written, ==, utf8_len);
g_assert (result);
- g_assert (strcmp (result, utf8) == 0);
+ g_assert_cmpstr (result, ==, utf8);
g_assert_no_error (error3);
g_assert (result3);
- g_assert (strcmp (result3, utf8) == 0);
+ g_assert_cmpstr (result3, ==, utf8);
}
g_free (result);
result2 = g_utf8_to_utf16 (utf8, -1, &items_read2, &items_written2, &error2);
g_assert (error || items_read2 == items_read);
g_assert (error || items_written2 == items_written2);
- g_assert (!!result == !!result2);
- g_assert (!!error == !!error2);
+ g_assert_cmpint (!!result, ==, !!result2);
+ g_assert_cmpint (!!error, ==, !!error2);
if (result)
for (i = 0; i <= items_written; i++)
g_assert (result[i] == result2[i]);
if (error3 && error3->code == G_CONVERT_ERROR_PARTIAL_INPUT)
{
g_assert_no_error (error);
- g_assert (items_read == error_pos);
- g_assert (items_written == utf16_len);
+ g_assert_cmpint (items_read, ==, error_pos);
+ g_assert_cmpint (items_written, ==, utf16_len);
g_assert (result);
for (i = 0; i <= items_written; i++)
g_assert (result[i] == utf16[i]);
{
g_assert (error != NULL);
g_assert (result == NULL);
- g_assert (items_read == error_pos);
+ g_assert_cmpint (items_read, ==, error_pos);
g_error_free (error);
g_assert (error3 != NULL);
else
{
g_assert_no_error (error);
- g_assert (items_read == utf8_len);
- g_assert (items_written == utf16_len);
+ g_assert_cmpint (items_read, ==, utf8_len);
+ g_assert_cmpint (items_written, ==, utf16_len);
g_assert (result);
for (i = 0; i <= items_written; i++)
g_assert (result[i] == utf16[i]);
g_assert (error || items_read2 == items_read);
g_assert (error || items_written2 == items_written);
- g_assert (!!result == !!result2);
- g_assert (!!error == !!error2);
+ g_assert_cmpint (!!result, ==, !!result2);
+ g_assert_cmpint (!!error, ==, !!error2);
if (result)
- g_assert (strcmp (result, result2) == 0);
+ g_assert_cmpstr (result, ==, result2);
g_free (result2);
if (error2)
if (error3 && error3->code == G_CONVERT_ERROR_PARTIAL_INPUT)
{
g_assert_no_error (error);
- g_assert (items_read == error_pos);
- g_assert (items_read + 1 == utf16_len);
- g_assert (items_written == utf8_len);
+ g_assert_cmpint (items_read, ==, error_pos);
+ g_assert_cmpint (items_read + 1, ==, utf16_len);
+ g_assert_cmpint (items_written, ==, utf8_len);
g_assert (result);
- g_assert (strcmp (result, utf8) == 0);
+ g_assert_cmpstr (result, ==, utf8);
g_error_free (error3);
}
else if (error_pos)
{
g_assert (error != NULL);
g_assert (result == NULL);
- g_assert (items_read == error_pos);
+ g_assert_cmpint (items_read, ==, error_pos);
g_error_free (error);
g_assert (error3 != NULL);
else
{
g_assert_no_error (error);
- g_assert (items_read == utf16_len);
- g_assert (items_written == utf8_len);
+ g_assert_cmpint (items_read, ==, utf16_len);
+ g_assert_cmpint (items_written, ==, utf8_len);
g_assert (result);
- g_assert (strcmp (result, utf8) == 0);
+ g_assert_cmpstr (result, ==, utf8);
g_assert_no_error (error3);
g_assert (result3);
- g_assert (strcmp (result3, utf8) == 0);
+ g_assert_cmpstr (result3, ==, utf8);
}
g_free (result);
g_assert (error || items_read2 == items_read);
g_assert (error || items_written2 == items_written);
- g_assert (!!result == !!result2);
- g_assert (!!error == !!error2);
+ g_assert_cmpint (!!result, ==, !!result2);
+ g_assert_cmpint (!!error, ==, !!error2);
if (result)
for (i = 0; i <= utf16_len; i++)
g_assert (result[i] == result2[i]);
{
g_assert (error != NULL);
g_assert (result == NULL);
- g_assert (items_read == error_pos);
+ g_assert_cmpint (items_read, ==, error_pos);
g_error_free (error);
g_assert (error3 != NULL);
else
{
g_assert_no_error (error);
- g_assert (items_read == ucs4_len);
- g_assert (items_written == utf16_len);
+ g_assert_cmpint (items_read, ==, ucs4_len);
+ g_assert_cmpint (items_written, ==, utf16_len);
g_assert (result);
for (i = 0; i <= utf16_len; i++)
g_assert (result[i] == utf16[i]);
result2 = g_utf16_to_ucs4 (utf16, -1, &items_read2, &items_written2, &error2);
g_assert (error || items_read2 == items_read);
g_assert (error || items_written2 == items_written2);
- g_assert (!!result == !!result2);
- g_assert (!!error == !!error2);
+ g_assert_cmpint (!!result, ==, !!result2);
+ g_assert_cmpint (!!error, ==, !!error2);
if (result)
for (i = 0; i <= items_written; i++)
g_assert (result[i] == result2[i]);
if (error3 && error3->code == G_CONVERT_ERROR_PARTIAL_INPUT)
{
g_assert_no_error (error);
- g_assert (items_read == error_pos);
- g_assert (items_read + 1 == utf16_len);
- g_assert (items_written == ucs4_len);
+ g_assert_cmpint (items_read, ==, error_pos);
+ g_assert_cmpint (items_read + 1, ==, utf16_len);
+ g_assert_cmpint (items_written, ==, ucs4_len);
g_assert (result);
for (i = 0; i <= items_written; i++)
g_assert (result[i] == ucs4[i]);
{
g_assert (error != NULL);
g_assert (result == NULL);
- g_assert (items_read == error_pos);
+ g_assert_cmpint (items_read, ==, error_pos);
g_error_free (error);
g_assert (error3 != NULL);
else
{
g_assert_no_error (error);
- g_assert (items_read == utf16_len);
- g_assert (items_written == ucs4_len);
+ g_assert_cmpint (items_read, ==, utf16_len);
+ g_assert_cmpint (items_written, ==, ucs4_len);
g_assert (result);
for (i = 0; i <= ucs4_len; i++)
g_assert (result[i] == ucs4[i]);