From 73d0a86698528bf73d029e35a57ce7b38783cf2a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 21 Dec 2012 18:26:55 +0000 Subject: Fix crash when serd_node_new_decimal is called with infinity or NaN. git-svn-id: http://svn.drobilla.net/serd/trunk@401 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- tests/serd_test.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/serd_test.c b/tests/serd_test.c index 7ce2aa55..f53e3494 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -114,15 +114,18 @@ main(void) // Test serd_node_new_decimal const double dbl_test_nums[] = { - 0.0, 9.0, 10.0, .01, 2.05, -16.00001, 5.000000005, 0.0000000001 + 0.0, 9.0, 10.0, .01, 2.05, -16.00001, 5.000000005, 0.0000000001, NAN, INFINITY }; const char* dbl_test_strs[] = { - "0.0", "9.0", "10.0", "0.01", "2.05", "-16.00001", "5.00000001", "0.0" + "0.0", "9.0", "10.0", "0.01", "2.05", "-16.00001", "5.00000001", "0.0", NULL, NULL }; for (unsigned i = 0; i < sizeof(dbl_test_nums) / sizeof(double); ++i) { SerdNode node = serd_node_new_decimal(dbl_test_nums[i], 8); + if (node.buf == dbl_test_strs[i]) { + continue; + } if (strcmp((const char*)node.buf, (const char*)dbl_test_strs[i])) { return failure("Serialised `%s' != %s\n", node.buf, dbl_test_strs[i]); -- cgit v1.2.1