From 1997ab63fb66a55341de0311e1b309419a32d724 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 31 Dec 2018 11:48:42 -0500 Subject: Fix various warnings and conversion issues --- tests/model_test.c | 4 ++-- tests/serd_test.c | 34 ++++++++++++++++++++++++---------- 2 files changed, 26 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/model_test.c b/tests/model_test.c index a6614ac1..aa3af753 100644 --- a/tests/model_test.c +++ b/tests/model_test.c @@ -606,7 +606,7 @@ static int test_triple_index_read(SerdWorld* world, const unsigned n_quads) { for (unsigned i = 0; i < 6; ++i) { - SerdModel* model = serd_model_new(world, (1 << i)); + SerdModel* model = serd_model_new(world, (1u << i)); generate(world, model, n_quads, 0); assert(!test_read(world, model, 0, n_quads)); serd_model_free(model); @@ -619,7 +619,7 @@ static int test_quad_index_read(SerdWorld* world, const unsigned n_quads) { for (unsigned i = 0; i < 6; ++i) { - SerdModel* model = serd_model_new(world, (1 << i) | SERD_INDEX_GRAPHS); + SerdModel* model = serd_model_new(world, (1u << i) | SERD_INDEX_GRAPHS); const SerdNode* graph = uri(world, 42); generate(world, model, n_quads, graph); assert(!test_read(world, model, graph, n_quads)); diff --git a/tests/serd_test.c b/tests/serd_test.c index 34463f7e..30f433fd 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -257,13 +257,27 @@ test_string_to_double(void) static void test_double_to_node(void) { - const double dbl_test_nums[] = { - 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", NULL, NULL - }; + const double dbl_test_nums[] = { 0.0, + 9.0, + 10.0, + .01, + 2.05, + -16.00001, + 5.000000005, + 0.0000000001, + (double)NAN, + (double)INFINITY }; + + const char* dbl_test_strs[] = { "0.0", + "9.0", + "10.0", + "0.01", + "2.05", + "-16.00001", + "5.00000001", + "0.0", + NULL, + NULL }; for (size_t i = 0; i < sizeof(dbl_test_nums) / sizeof(double); ++i) { SerdNode* node = serd_new_decimal(dbl_test_nums[i], 8, NULL); @@ -665,9 +679,9 @@ test_writer(const char* const path) } // Write statements with bad UTF-8 (should be replaced) - const char bad_str[] = { (char)0xFF, (char)0x90, 'h', 'i', 0 }; - SerdNode* bad_lit = serd_new_string(bad_str); - SerdNode* bad_uri = serd_new_uri(bad_str); + const uint8_t bad_str[] = { 0xFF, 0x90, 'h', 'i', 0 }; + SerdNode* bad_lit = serd_new_string((const char*)bad_str); + SerdNode* bad_uri = serd_new_uri((const char*)bad_str); assert(!serd_sink_write(iface, 0, s, p, bad_lit, 0)); assert(!serd_sink_write(iface, 0, s, p, bad_uri, 0)); serd_node_free(bad_uri); -- cgit v1.2.1