aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-12-31 11:48:42 -0500
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:58 +0100
commit1997ab63fb66a55341de0311e1b309419a32d724 (patch)
treed1513d326679ec79b01ab4b0e6cee310c721514b /tests
parent60bb4a81c03d6b0a08f9c858ff1a99bf3bcc602e (diff)
downloadserd-1997ab63fb66a55341de0311e1b309419a32d724.tar.gz
serd-1997ab63fb66a55341de0311e1b309419a32d724.tar.bz2
serd-1997ab63fb66a55341de0311e1b309419a32d724.zip
Fix various warnings and conversion issues
Diffstat (limited to 'tests')
-rw-r--r--tests/model_test.c4
-rw-r--r--tests/serd_test.c34
2 files changed, 26 insertions, 12 deletions
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);