aboutsummaryrefslogtreecommitdiffstats
path: root/tests/serd_test.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-12-21 18:26:55 +0000
committerDavid Robillard <d@drobilla.net>2012-12-21 18:26:55 +0000
commit73d0a86698528bf73d029e35a57ce7b38783cf2a (patch)
treecee6ad10793da41e78b3324a935c7cf94b1293fa /tests/serd_test.c
parent9d36ba3e802705b1d6236eefc99916af6116a448 (diff)
downloadserd-73d0a86698528bf73d029e35a57ce7b38783cf2a.tar.gz
serd-73d0a86698528bf73d029e35a57ce7b38783cf2a.tar.bz2
serd-73d0a86698528bf73d029e35a57ce7b38783cf2a.zip
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
Diffstat (limited to 'tests/serd_test.c')
-rw-r--r--tests/serd_test.c7
1 files changed, 5 insertions, 2 deletions
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]);