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>2019-12-20 10:26:55 -0500
commit6644fef8c9f1fe9ccfbc049fe9f4a5e26448d7fd (patch)
tree4a1a1ee5fc25ba2e0da4d7ad9918e63836308475 /tests
parent8ab439b7bc50533da52a8be232950b615d75c532 (diff)
downloadserd-6644fef8c9f1fe9ccfbc049fe9f4a5e26448d7fd.tar.gz
serd-6644fef8c9f1fe9ccfbc049fe9f4a5e26448d7fd.tar.bz2
serd-6644fef8c9f1fe9ccfbc049fe9f4a5e26448d7fd.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 37a43b6e..fc893794 100644
--- a/tests/model_test.c
+++ b/tests/model_test.c
@@ -599,7 +599,7 @@ static int
test_triple_index_read(SerdWorld* world, const size_t 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);
@@ -612,7 +612,7 @@ static int
test_quad_index_read(SerdWorld* world, const size_t 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 852c1190..36c27e28 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -220,13 +220,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 (unsigned i = 0; i < sizeof(dbl_test_nums) / sizeof(double); ++i) {
SerdNode* node = serd_new_decimal(dbl_test_nums[i], 8, NULL);
@@ -719,9 +733,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);