Improve error reporting.

2004-10-26  Matthias Clasen  <mclasen@redhat.com>

	* tests/strtod-test.c (test_string): Improve error reporting.
This commit is contained in:
Matthias Clasen 2004-10-26 04:16:02 +00:00 committed by Matthias Clasen
parent 5c38cfa58d
commit 491732c99d
6 changed files with 24 additions and 3 deletions

View File

@ -1,3 +1,7 @@
2004-10-26 Matthias Clasen <mclasen@redhat.com>
* tests/strtod-test.c (test_string): Improve error reporting.
Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org> Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org>
* autogen.sh: rm autom4te.cache, since it might interfere with * autogen.sh: rm autom4te.cache, since it might interfere with

View File

@ -1,3 +1,7 @@
2004-10-26 Matthias Clasen <mclasen@redhat.com>
* tests/strtod-test.c (test_string): Improve error reporting.
Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org> Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org>
* autogen.sh: rm autom4te.cache, since it might interfere with * autogen.sh: rm autom4te.cache, since it might interfere with

View File

@ -1,3 +1,7 @@
2004-10-26 Matthias Clasen <mclasen@redhat.com>
* tests/strtod-test.c (test_string): Improve error reporting.
Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org> Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org>
* autogen.sh: rm autom4te.cache, since it might interfere with * autogen.sh: rm autom4te.cache, since it might interfere with

View File

@ -1,3 +1,7 @@
2004-10-26 Matthias Clasen <mclasen@redhat.com>
* tests/strtod-test.c (test_string): Improve error reporting.
Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org> Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org>
* autogen.sh: rm autom4te.cache, since it might interfere with * autogen.sh: rm autom4te.cache, since it might interfere with

View File

@ -1,3 +1,7 @@
2004-10-26 Matthias Clasen <mclasen@redhat.com>
* tests/strtod-test.c (test_string): Improve error reporting.
Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org> Mon Oct 25 15:05:18 2004 Manish Singh <yosh@gimp.org>
* autogen.sh: rm autom4te.cache, since it might interfere with * autogen.sh: rm autom4te.cache, since it might interfere with

View File

@ -27,11 +27,11 @@ test_string (char *number, double res, gboolean check_end, int correct_len)
setlocale (LC_NUMERIC, locales[l]); setlocale (LC_NUMERIC, locales[l]);
d = g_ascii_strtod (number, &end); d = g_ascii_strtod (number, &end);
if (d != res) if (d != res)
g_print ("g_ascii_strtod for locale %s failed\n", locales[l]); g_print ("g_ascii_strtod on \"%s\" for locale %s failed\n", number, locales[l]);
if (check_end && end - number != correct_len) if (check_end && end - number != correct_len)
g_print ("g_ascii_strtod for locale %s endptr was wrong\n", locales[l]); g_print ("g_ascii_strtod on \"%s\" for locale %s endptr was wrong, leftover: %s\n", number, locales[l], end);
if (!check_end && end - number != strlen (number)) if (!check_end && end - number != strlen (number))
g_print ("g_ascii_strtod for locale %s endptr was wrong\n", locales[l]); g_print ("g_ascii_strtod on \"%s\" for locale %s endptr was wrong, leftover: %s\n", number, locales[l], end);
} }
g_free (number); g_free (number);
@ -50,6 +50,7 @@ main ()
test_string ("-123.123", -123.123, FALSE, 0); test_string ("-123.123", -123.123, FALSE, 0);
test_string ("-123.123e2", -123.123e2, FALSE, 0); test_string ("-123.123e2", -123.123e2, FALSE, 0);
test_string ("-123.123e-2", -123.123e-2, FALSE, 0); test_string ("-123.123e-2", -123.123e-2, FALSE, 0);
test_string ("1e1", 1e1, FALSE, 0);
test_string ("5.4", 5.4, TRUE, 3); test_string ("5.4", 5.4, TRUE, 3);
test_string ("5.4,5.5", 5.4, TRUE, 3); test_string ("5.4,5.5", 5.4, TRUE, 3);
test_string ("5,4", 5.0, TRUE, 1); test_string ("5,4", 5.0, TRUE, 1);