[glib] Don't abort if g_ascii_strtod tests fail
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Don't abort if g_ascii_strtod tests fail
- Date: Wed, 30 Nov 2011 03:55:06 +0000 (UTC)
commit b13e79da62b256058e4ca1d9fdd46376d3013f16
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Nov 29 22:53:50 2011 -0500
Don't abort if g_ascii_strtod tests fail
https://bugzilla.gnome.org/show_bug.cgi?id=652560
glib/tests/strfuncs.c | 25 ++-----------------------
1 files changed, 2 insertions(+), 23 deletions(-)
---
diff --git a/glib/tests/strfuncs.c b/glib/tests/strfuncs.c
index d9e57d0..0dffe87 100644
--- a/glib/tests/strfuncs.c
+++ b/glib/tests/strfuncs.c
@@ -874,33 +874,12 @@ check_strtod_string (gchar *number,
for (l = 0; l < G_N_ELEMENTS (locales); l++)
{
- gboolean ok;
gchar *end = "(unset)";
setlocale (LC_NUMERIC, locales[l]);
d = g_ascii_strtod (number, &end);
- ok = isnan (res) ? isnan (d) : (d == res);
- if (!ok)
- {
- g_error ("g_ascii_strtod on \"%s\" for locale %s failed\n" \
- "expected %f (nan %d) actual %f (nan %d)\n",
- number, locales[l],
- res, isnan (res),
- d, isnan (d));
- }
-
- ok = (end - number) == (check_end ? correct_len : strlen (number));
- if (!ok) {
- if (end == NULL)
- g_error ("g_ascii_strtod on \"%s\" for locale %s endptr was NULL\n",
- number, locales[l]);
- else if (end >= number && end <= number + strlen (number))
- g_error ("g_ascii_strtod on \"%s\" for locale %s endptr was wrong, leftover: \"%s\"\n",
- number, locales[l], end);
- else
- g_error ("g_ascii_strtod on \"%s\" for locale %s endptr was REALLY wrong (number=%p, end=%p)\n",
- number, locales[l], number, end);
- }
+ g_assert (isnan (res) ? isnan (d) : (d == res));
+ g_assert ((end - number) == (check_end ? correct_len : strlen (number)));
}
g_free (number);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]