]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Remove usage of newer check API
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 4 Dec 2023 06:10:41 +0000 (03:10 -0300)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Mon, 4 Dec 2023 06:12:38 +0000 (03:12 -0300)
The distant virtual machine I used to replicate #101 had what I assume
is an older version of check, so I had to tweak some validations.

Looks like I have to expand my VM repertoire.

test/cache/local_cache_test.c
test/data_structure/uthash_test.c
test/rtr/db/deltas_array_test.c
test/rtr/db/vrps_test.c
test/rtr/pdu_stream_test.c

index b9284bf59bffeae569eda72b5849a1151e7bff17..1ac44079eaf65d6296d396c84f66cf1032adb7db 100644 (file)
@@ -103,7 +103,7 @@ setup_test(void)
 
        dl_error = false;
        cache = cache_create(TAL_FILE);
-       ck_assert_ptr_nonnull(cache);
+       ck_assert_ptr_ne(NULL, cache);
        SLIST_INIT(&downloaded);
 }
 
@@ -746,7 +746,7 @@ START_TEST(test_metadata_json)
        cache_reset(cache);
 
        load_metadata_json(cache);
-       ck_assert_ptr_nonnull(cache->ht);
+       ck_assert_ptr_ne(NULL, cache->ht);
 
        validate_cache(0,
            NODE("rsync://a.b.c/d", 0, 1, 0),
@@ -794,7 +794,7 @@ START_TEST(test_recover)
 
        /* Query on empty database */
        PREPARE_URI_LIST(&uris, "rsync://a.b.c/d", "https://a.b.c/d");
-       ck_assert_ptr_null(cache_recover(cache, &uris, false));
+       ck_assert_ptr_eq(NULL, cache_recover(cache, &uris, false));
        uris_cleanup(&uris);
 
        /* Only first URI is cached */
@@ -826,7 +826,7 @@ START_TEST(test_recover)
        run_cache_download("rsync://d/e", 0, 1, 0);
 
        PREPARE_URI_LIST(&uris, "rsync://a/b/c", "https://d/e", "https://f");
-       ck_assert_ptr_null(cache_recover(cache, &uris, false));
+       ck_assert_ptr_eq(NULL, cache_recover(cache, &uris, false));
        uris_cleanup(&uris);
 
        /*
@@ -862,7 +862,7 @@ START_TEST(test_recover)
 
        /* No successful caches: No viable candidates */
        PREPARE_URI_LIST(&uris, "rsync://b/2", "rsync://b/4", "rsync://b/6");
-       ck_assert_ptr_null(cache_recover(cache, &uris, false));
+       ck_assert_ptr_eq(NULL, cache_recover(cache, &uris, false));
        uris_cleanup(&uris);
 
        /* Status: CNF_SUCCESS is better than 0. */
@@ -883,7 +883,7 @@ START_TEST(test_recover)
 
        /* Parents of downloaded nodes */
        PREPARE_URI_LIST(&uris, "rsync://a", "rsync://b");
-       ck_assert_ptr_null(cache_recover(cache, &uris, false));
+       ck_assert_ptr_eq(NULL, cache_recover(cache, &uris, false));
        uris_cleanup(&uris);
 
        /* Try them all at the same time */
index 98eec082deaa44f304a4e1c12509eb8c971fb7b5..357536a289f35b8cd81b7fff5d81d198a3898aaa 100644 (file)
@@ -39,10 +39,10 @@ check_table(struct uthash_table *table, unsigned int argcount, ...)
        for (a = 0; a < argcount; a++) {
                HASH_FIND_INT(table->nodes, &a, node);
                if (expected[a]) {
-                       ck_assert_ptr_nonnull(node);
+                       ck_assert_ptr_ne(NULL, node);
                        ck_assert_int_eq(a, node->key);
                } else {
-                       ck_assert_ptr_null(node);
+                       ck_assert_ptr_eq(NULL, node);
                }
        }
 
@@ -63,7 +63,7 @@ add_node(struct uthash_table *table, int key)
        int error;
 
        new = malloc(sizeof(struct uthash_node));
-       ck_assert_ptr_nonnull(new);
+       ck_assert_ptr_ne(NULL, new);
 
        memset(new, 0, sizeof(*new));
        new->key = key;
@@ -88,7 +88,7 @@ clean_table(struct uthash_table *table)
                free(node);
        }
 
-       ck_assert_ptr_null(table->nodes);
+       ck_assert_ptr_eq(NULL, table->nodes);
 }
 
 START_TEST(test_replace)
@@ -149,7 +149,7 @@ START_TEST(test_uri)
        keystrlen = strlen(keystr);
 
        HASH_FIND(hh, table, keystr, keystrlen, node);
-       ck_assert_ptr_null(node);
+       ck_assert_ptr_eq(NULL, node);
 
        /* Add a node */
        node = malloc(sizeof(struct test2_node));
@@ -177,7 +177,7 @@ START_TEST(test_uri)
        keystrlen = strlen(keystr);
        node2 = NULL;
        HASH_FIND(hh, table, keystr, keystrlen, node2);
-       ck_assert_ptr_null(node2);
+       ck_assert_ptr_eq(NULL, node2);
        free(keystr);
 
        /* free the hash table contents */
index 562df338a515c41d0110d97757441bc2ca165c2e..b48d6fd07089286936cdae6785aef1f8dc6cfb53 100644 (file)
@@ -58,7 +58,7 @@ START_TEST(add_only)
 
        for (i = 0; i < TOTAL_CREATED; i++) {
                created[i] = deltas_create();
-               ck_assert_ptr_nonnull(created[i]);
+               ck_assert_ptr_ne(NULL, created[i]);
        }
 
        test_foreach(darray, 0, 0);
index ef8b727f237c0028e86ea91037bfa9b50921a29a..df867b93e82274e835ec74f609fd6bc35a625997 100644 (file)
@@ -289,7 +289,7 @@ check_deltas(serial_t from, serial_t to, bool const *expected_deltas)
        array_index i;
 
        deltas = deltas_create();
-       ck_assert_ptr_nonnull(deltas);
+       ck_assert_ptr_ne(NULL, deltas);
 
        ck_assert_int_eq(0, vrps_foreach_delta_since(from, &actual_serial,
            vrp_add, rk_add, deltas));
index 9c7631939d58986392850f935b8174fdf1fc0882..0314cafc6a7a8a8a0fbea0c832fed0bb1596cd78 100644 (file)
@@ -153,7 +153,7 @@ START_TEST(test_error_report_from_stream)
 
        stream = create_stream_fd(input, sizeof(input), RTR_V1);
        ck_assert_uint_eq(false, pdustream_next(stream, &request));
-       ck_assert_ptr_null(request);
+       ck_assert_ptr_eq(NULL, request);
        pdustream_destroy(&stream);
 }
 END_TEST
@@ -220,7 +220,7 @@ START_TEST(test_multiple_pdus)
 
        close(pipes[1]);
        ck_assert_uint_eq(false, pdustream_next(stream, &request));
-       ck_assert_ptr_null(request);
+       ck_assert_ptr_eq(NULL, request);
 
        /* Clean up */
 
@@ -237,7 +237,7 @@ START_TEST(test_interrupted)
        stream = create_stream_fd(input, sizeof(input), RTR_V1);
 
        ck_assert_uint_eq(false, pdustream_next(stream, &request));
-       ck_assert_ptr_null(request);
+       ck_assert_ptr_eq(NULL, request);
 
        pdustream_destroy(&stream);
 }
@@ -252,7 +252,10 @@ test_read_string_success(unsigned char *input, size_t length, char *expected)
        stream = create_stream(input, length);
 
        actual = read_string(stream, length);
-       ck_assert_pstr_eq(expected, actual);
+       if (expected == NULL)
+               ck_assert_ptr_eq(NULL, actual);
+       else
+               ck_assert_str_eq(expected, actual);
 
        free(actual);
        free(stream);