Commit aceef30c authored by Jan Včelák's avatar Jan Včelák 🚀

tests: remove trailing whitespaces

parent 9b488b3f
......@@ -260,7 +260,6 @@ static void *x_realloc(void *, size_t, const char *, int)
static char *x_strdup(const char *, const char *, int)
__attribute__((__malloc__, __nonnull__));
/*
* Report a fatal error, including the results of strerror, and exit.
*/
......@@ -280,7 +279,6 @@ sysdie(const char *format, ...)
exit(1);
}
/*
* Allocate zeroed memory, reporting a fatal error and exiting on failure.
*/
......@@ -298,7 +296,6 @@ x_calloc(size_t n, size_t size, const char *file, int line)
return p;
}
/*
* Allocate memory, reporting a fatal error and exiting on failure.
*/
......@@ -314,7 +311,6 @@ x_malloc(size_t size, const char *file, int line)
return p;
}
/*
* Reallocate memory, reporting a fatal error and exiting on failure.
*/
......@@ -328,7 +324,6 @@ x_realloc(void *p, size_t size, const char *file, int line)
return p;
}
/*
* Copy a string, reporting a fatal error and exiting on failure.
*/
......@@ -347,7 +342,6 @@ x_strdup(const char *s, const char *file, int line)
return p;
}
/*
* Given a struct timeval, return the number of seconds it represents as a
* double. Use difftime() to convert a time_t to a double.
......@@ -358,7 +352,6 @@ tv_seconds(const struct timeval *tv)
return difftime(tv->tv_sec, 0) + tv->tv_usec * 1e-6;
}
/*
* Given two struct timevals, return the difference in seconds.
*/
......@@ -368,7 +361,6 @@ tv_diff(const struct timeval *tv1, const struct timeval *tv0)
return tv_seconds(tv1) - tv_seconds(tv0);
}
/*
* Given two struct timevals, return the sum in seconds as a double.
*/
......@@ -378,7 +370,6 @@ tv_sum(const struct timeval *tv1, const struct timeval *tv2)
return tv_seconds(tv1) + tv_seconds(tv2);
}
/*
* Given a pointer to a string, skip any leading whitespace and return a
* pointer to the first non-whitespace character.
......@@ -391,7 +382,6 @@ skip_whitespace(const char *p)
return p;
}
/*
* Start a program, connecting its stdout to a pipe on our end and its stderr
* to /dev/null, and storing the file descriptor to read from in the two
......@@ -435,7 +425,6 @@ test_start(const char *path, int *fd)
return child;
}
/*
* Back up over the output saying what test we were executing.
*/
......@@ -455,7 +444,6 @@ test_backspace(struct testset *ts)
ts->length = 0;
}
/*
* Read the plan line of test output, which should contain the range of test
* numbers. We may initialize the testset structure here if we haven't yet
......@@ -539,7 +527,6 @@ test_plan(const char *line, struct testset *ts)
return 1;
}
/*
* Given a single line of output from a test, parse it and return the success
* status of that test. Anything printed to stdout not matching the form
......@@ -685,7 +672,6 @@ test_checkline(const char *line, struct testset *ts)
}
}
/*
* Print out a range of test numbers, returning the number of characters it
* took up. Takes the first number, the last number, the number of characters
......@@ -731,7 +717,6 @@ test_print_range(unsigned long first, unsigned long last, unsigned int chars,
return needed;
}
/*
* Summarize a single test set. The second argument is 0 if the set exited
* cleanly, a positive integer representing the exit status if it exited
......@@ -808,7 +793,6 @@ test_summarize(struct testset *ts, int status)
putchar('\n');
}
/*
* Given a test set, analyze the results, classify the exit status, handle a
* few special error messages, and then pass it along to test_summarize() for
......@@ -931,7 +915,6 @@ test_run(struct testset *ts, FILE *logfile)
return status;
}
/* Summarize a list of test failures. */
static void
test_fail_summary(const struct testlist *fails)
......@@ -979,7 +962,6 @@ test_fail_summary(const struct testlist *fails)
}
}
/*
* Check whether a given file path is a valid test. Currently, this checks
* whether it is executable and is a regular file. Returns true or false.
......@@ -998,7 +980,6 @@ is_valid_test(const char *path)
return 1;
}
/*
* Given the name of a test, a pointer to the testset struct, and the source
* and build directories, find the test. We try first relative to the current
......@@ -1047,7 +1028,6 @@ find_test(const char *name, const char *source, const char *build)
return path;
}
/*
* Read a list of tests from a file, returning the list of tests as a struct
* testlist. Reports an error to standard error and exits if the list of
......@@ -1102,7 +1082,6 @@ read_test_list(const char *filename)
return listhead;
}
/*
* Build a list of tests from command line arguments. Takes the argv and argc
* representing the command line arguments and returns a newly allocated test
......@@ -1139,7 +1118,6 @@ build_test_list(char *argv[], int argc)
return listhead;
}
/* Free a struct testset. */
static void
free_testset(struct testset *ts)
......@@ -1152,7 +1130,6 @@ free_testset(struct testset *ts)
free(ts);
}
/*
* Run a batch of tests. Takes two additional parameters: the root of the
* source directory and the root of the build directory. Test programs will
......@@ -1303,7 +1280,6 @@ test_batch(struct testlist *tests, const char *source, const char *build,
return (failed == 0 && aborted == 0);
}
/*
* Run a single test case. This involves just running the test program after
* having done the environment setup and finding the test program.
......@@ -1318,7 +1294,6 @@ test_single(const char *program, const char *source, const char *build)
sysdie("cannot exec %s", path);
}
/*
* Main routine. Set the SOURCE and BUILD environment variables and then,
* given a file listing tests, run each test listed.
......
......@@ -79,7 +79,6 @@ static unsigned long _failed = 0;
static pid_t _process = 0;
static int _lazy = 0;
/*
* Our exit handler. Called on completion of the test to report a summary of
* results provided we're still in the original process. This also handles
......@@ -115,7 +114,6 @@ finish(void)
}
}
/*
* Initialize things. Turns on line buffering on stdout and then prints out
* the number of tests in the test suite.
......@@ -134,7 +132,6 @@ plan(unsigned long count)
atexit(finish);
}
/*
* Initialize things for lazy planning, where we'll automatically print out a
* plan at the end of the program. Turns on line buffering on stdout as well.
......@@ -151,7 +148,6 @@ plan_lazy(void)
atexit(finish);
}
/*
* Skip the entire test suite and exits. Should be called instead of plan(),
* not after it, since it prints out a special plan line.
......@@ -173,7 +169,6 @@ skip_all(const char *format, ...)
exit(0);
}
/*
* Print the test description.
*/
......@@ -184,7 +179,6 @@ print_desc(const char *format, va_list args)
vprintf(format, args);
}
/*
* Takes a boolean success value and assumes the test passes if that value
* is true and fails if that value is false.
......@@ -206,7 +200,6 @@ ok(int success, const char *format, ...)
putchar('\n');
}
/*
* Same as ok(), but takes the format arguments as a va_list.
*/
......@@ -222,7 +215,6 @@ okv(int success, const char *format, va_list args)
putchar('\n');
}
/*
* Skip a test.
*/
......@@ -242,7 +234,6 @@ skip(const char *reason, ...)
putchar('\n');
}
/*
* Report the same status on the next count tests.
*/
......@@ -267,7 +258,6 @@ ok_block(unsigned long count, int status, const char *format, ...)
}
}
/*
* Skip the next count tests.
*/
......@@ -291,7 +281,6 @@ skip_block(unsigned long count, const char *reason, ...)
}
}
/*
* Takes an expected integer and a seen integer and assumes the test passes
* if those two numbers match.
......@@ -317,7 +306,6 @@ is_int(long long wanted, long long seen, const char *format, ...)
putchar('\n');
}
/*
* Takes a string and what the string should be, and assumes the test passes
* if those strings match (using strcmp).
......@@ -347,7 +335,6 @@ is_string(const char *wanted, const char *seen, const char *format, ...)
putchar('\n');
}
/*
* Takes an expected unsigned long and a seen unsigned long and assumes the
* test passes if the two numbers match. Otherwise, reports them in hex.
......@@ -376,7 +363,6 @@ is_hex(unsigned long long wanted, unsigned long long seen,
putchar('\n');
}
/*
* Bail out with an error.
*/
......@@ -395,7 +381,6 @@ bail(const char *format, ...)
exit(255);
}
/*
* Bail out with an error, appending strerror(errno).
*/
......@@ -415,7 +400,6 @@ sysbail(const char *format, ...)
exit(255);
}
/*
* Report a diagnostic to stderr.
*/
......@@ -433,7 +417,6 @@ diag(const char *format, ...)
printf("\n");
}
/*
* Report a diagnostic to stderr, appending strerror(errno).
*/
......@@ -452,7 +435,6 @@ sysdiag(const char *format, ...)
printf(": %s\n", strerror(oerrno));
}
/*
* Allocate cleared memory, reporting a fatal error with bail on failure.
*/
......@@ -467,7 +449,6 @@ bcalloc(size_t n, size_t size)
return p;
}
/*
* Allocate memory, reporting a fatal error with bail on failure.
*/
......@@ -482,7 +463,6 @@ bmalloc(size_t size)
return p;
}
/*
* Reallocate memory, reporting a fatal error with bail on failure.
*/
......@@ -495,7 +475,6 @@ brealloc(void *p, size_t size)
return p;
}
/*
* Copy a string, reporting a fatal error with bail on failure.
*/
......@@ -513,7 +492,6 @@ bstrdup(const char *s)
return p;
}
/*
* Copy up to n characters of a string, reporting a fatal error with bail on
* failure. Don't use the system strndup function, since it may not exist and
......@@ -538,7 +516,6 @@ bstrndup(const char *s, size_t n)
return copy;
}
/*
* Locate a test file. Given the partial path to a file, look under BUILD and
* then SOURCE for the file and return the full path to the file. Returns
......@@ -573,7 +550,6 @@ test_file_path(const char *file)
return path;
}
/*
* Free a path returned from test_file_path(). This function exists primarily
* for Windows, where memory must be freed from the same library domain that
......@@ -586,7 +562,6 @@ test_file_path_free(char *path)
free(path);
}
/*
* Create a temporary directory, tmp, under BUILD if set and the current
* directory if it does not. Returns the path to the temporary directory in
......@@ -616,7 +591,6 @@ test_tmpdir(void)
return path;
}
/*
* Free a path returned from test_tmpdir() and attempt to remove the
* directory. If we can't delete the directory, don't worry; something else
......
......@@ -156,4 +156,3 @@ int main(int argc, char *argv[])
return 0;
}
......@@ -105,7 +105,6 @@ int main(int argc, char *argv[])
ok(ret != -1, "get TYPE256 ret");
ok(strcmp(name, "TYPE256") == 0, "get TYPE256 name");
// Class num to string:
// 7. CLASS0
ret = knot_rrclass_to_string(0, name, BUF_LEN);
......
......@@ -303,7 +303,6 @@ static bool test_setters(knot_rrset_t *opt_rr, int *done)
knot_strerror(ret));
(*done)++;
knot_rdata_t *rdata = knot_rdataset_at(&opt_rr->rrs, 0);
if (rdata == NULL) {
skip_block(2, "No RDATA in OPT RR.");
......@@ -341,7 +340,6 @@ static void test_client_subnet()
uint8_t data[KNOT_EDNS_MAX_OPTION_CLIENT_SUBNET] = { 0 };
uint16_t data_len = sizeof(data);
/* Create IPv4 subnet - src mask 32 */
family = KNOT_ADDR_FAMILY_IPV4;
data_len = sizeof(data);
......
......@@ -27,7 +27,6 @@
#define WRITE_PATTERN ((char) 0xde)
#define WRITE_PATTERN_LEN sizeof(char)
/* Subtract the `struct timeval' values X and Y,
storing the result in RESULT.
Return 1 if the difference is negative, otherwise 0.
......
......@@ -171,7 +171,7 @@ int main(int argc, char *argv[])
}
}
ok(passed, "hattrie: find lesser or equal for all keys");
/* Next lookup. */
passed = true;
for (unsigned i = 0; i < key_count - 1 && passed; ++i) {
......@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
passed = val && *val == (void *)keys[(i + 1)];
}
ok(passed, "hattrie: find next for all keys");
/* Unsorted iteration */
size_t iterated = 0;
hattrie_iter_t *it = hattrie_iter_begin(trie, false);
......
......@@ -78,20 +78,20 @@ static void init_random_changeset(changeset_t *ch, const uint32_t from, const ui
{
int ret = changeset_init(ch, apex);
assert(ret == KNOT_EOK);
// Add SOAs
knot_rrset_t soa;
init_soa(&soa, from, apex);
ch->soa_from = knot_rrset_copy(&soa, NULL);
assert(ch->soa_from);
knot_rrset_clear(&soa, NULL);
init_soa(&soa, to, apex);
ch->soa_to = knot_rrset_copy(&soa, NULL);
assert(ch->soa_to);
knot_rrset_clear(&soa, NULL);
// Add RRs to add section
for (size_t i = 0; i < size / 2; ++i) {
knot_rrset_t rr;
......
......@@ -49,28 +49,28 @@ static knot_rrset_t *create_dummy_rrsig(const knot_dname_t *owner,
int main(int argc, char *argv[])
{
plan(23);
knot_dname_t *dummy_owner = knot_dname_from_str_alloc("test.");
// Test new
zone_node_t *node = node_new(dummy_owner, NULL);
ok(node != NULL, "Node: new");
assert(node);
ok(knot_dname_is_equal(node->owner, dummy_owner), "Node: new - set fields");
// Test parent setting
zone_node_t *parent = node_new(dummy_owner, NULL);
assert(parent);
node_set_parent(node, parent);
ok(node->parent == parent && parent->children == 1, "Node: set parent.");
node_free(&parent, NULL);
// Test RRSet addition
knot_rrset_t *dummy_rrset = create_dummy_rrset(dummy_owner, KNOT_RRTYPE_TXT);
int ret = node_add_rrset(node, dummy_rrset, NULL);
ok(ret == KNOT_EOK && node->rrset_count == 1 &&
knot_rdataset_eq(&dummy_rrset->rrs, &node->rrs[0].rrs), "Node: add RRSet.");
// Test shallow copy
node->flags |= NODE_FLAGS_DELEG;
zone_node_t *copy = node_shallow_copy(node, NULL);
......@@ -82,76 +82,75 @@ int main(int argc, char *argv[])
copy->rrset_count * sizeof(struct rr_data)) == 0 &&
copy->flags == node->flags;
ok(copy_ok, "Node: shallow copy - set fields.");
node_free(&copy, NULL);
// Test RRSet getters
knot_rrset_t *n_rrset = node_create_rrset(node, KNOT_RRTYPE_TXT);
ok(n_rrset && knot_rrset_equal(n_rrset, dummy_rrset, KNOT_RRSET_COMPARE_WHOLE),
"Node: create existing RRSet.");
knot_rrset_free(&n_rrset, NULL);
n_rrset = node_create_rrset(node, KNOT_RRTYPE_SOA);
ok(n_rrset == NULL, "Node: create non-existing RRSet.");
knot_rrset_t stack_rrset = node_rrset(node, KNOT_RRTYPE_TXT);
ok(knot_rrset_equal(&stack_rrset, dummy_rrset,
KNOT_RRSET_COMPARE_WHOLE), "Node: get existing RRSet.");
stack_rrset = node_rrset(node, KNOT_RRTYPE_SOA);
ok(knot_rrset_empty(&stack_rrset), "Node: get non-existent RRSet.");
knot_rdataset_t *n_rdataset = node_rdataset(node, KNOT_RRTYPE_TXT);
ok(n_rdataset && knot_rdataset_eq(n_rdataset, &dummy_rrset->rrs),
"Node: get existing rdataset.");
n_rdataset = node_rdataset(node, KNOT_RRTYPE_SOA);
ok(n_rdataset == NULL, "Node: get non-existing rdataset.");
stack_rrset = node_rrset_at(node, 0);
ok(knot_rrset_equal(&stack_rrset, dummy_rrset, KNOT_RRSET_COMPARE_WHOLE),
"Node: get existing position.");
stack_rrset = node_rrset_at(node, 1);
ok(knot_rrset_empty(&stack_rrset), "Node: get non-existent position.");
// Test TTL mismatch
knot_rdata_t *data = knot_rdataset_at(&dummy_rrset->rrs, 0);
knot_rdata_set_ttl(data, 1800);
ret = node_add_rrset(node, dummy_rrset, NULL);
ok(ret == KNOT_ETTL && node->rrset_count == 1,
"Node: add RRSet, TTL mismatch.");
knot_rrset_free(&dummy_rrset, NULL);
// Test bool functions
ok(node_rrtype_exists(node, KNOT_RRTYPE_TXT), "Node: type exists.");
ok(!node_rrtype_exists(node, KNOT_RRTYPE_AAAA), "Node: type does not exist.");
ok(!node_rrtype_is_signed(node, KNOT_RRTYPE_TXT), "Node: type is not signed.");
dummy_rrset = create_dummy_rrsig(dummy_owner, KNOT_RRTYPE_TXT);
ret = node_add_rrset(node, dummy_rrset, NULL);
assert(ret == KNOT_EOK);
ok(node_rrtype_is_signed(node, KNOT_RRTYPE_TXT), "Node: type is signed.");
knot_rrset_free(&dummy_rrset, NULL);
// Test remove RRset
node_remove_rdataset(node, KNOT_RRTYPE_AAAA);
ok(node->rrset_count == 2, "Node: remove non-existent rdataset.");
void *to_free = node_rdataset(node, KNOT_RRTYPE_TXT)->data;
node_remove_rdataset(node, KNOT_RRTYPE_TXT);
ok(node->rrset_count == 1, "Node: remove existing rdataset.");
free(to_free);
// "Test" freeing
node_free_rrsets(node, NULL);
ok(node->rrset_count == 0, "Node: free RRSets.");
node_free(&node, NULL);
ok(node == NULL, "Node: free.");
knot_dname_free(&dummy_owner, NULL);
return 0;
......
......@@ -23,11 +23,11 @@
int main(int argc, char *argv[])
{
plan(9);
// Test array size
size_t array_size = knot_rdata_array_size(16);
ok(array_size == sizeof(struct rr_offsets) + 16, "rdata: array size.");
// Test init
knot_rdata_t rdata[array_size];
uint8_t payload[16] = "abcdefghijklmnop";
......@@ -36,30 +36,30 @@ int main(int argc, char *argv[])
knot_rdata_ttl(rdata) == 3600 &&
memcmp(knot_rdata_data(rdata), payload, 16) == 0;
ok(set_ok, "rdata: init.");
// Test setters
knot_rdata_set_ttl(rdata, 1234);
ok(knot_rdata_ttl(rdata) == 1234, "rdata: set TTL.");
knot_rdata_set_rdlen(rdata, 1);
ok(knot_rdata_rdlen(rdata) == 1, "rdata: set RDLEN.");
// Test compare
knot_rdata_set_rdlen(rdata, 16);
ok(knot_rdata_cmp(rdata, rdata) == 0, "rdata: cmp eq.");
knot_rdata_t *lower = rdata;
knot_rdata_t greater[knot_rdata_array_size(16)];
knot_rdata_init(greater, 16, (uint8_t *)"qrstuvwxyz123456", 1234);
ok(knot_rdata_cmp(lower, greater) < 0, "rdata: cmp lower.");
ok(knot_rdata_cmp(greater, lower) > 0, "rdata: cmp greater.");
// Payloads will be the same.
memcpy(knot_rdata_data(greater), knot_rdata_data(lower), 16);
assert(knot_rdata_cmp(lower, greater) == 0);
knot_rdata_set_rdlen(lower, 15);
ok(knot_rdata_cmp(lower, greater) < 0, "rdata: cmp lower size.");
ok(knot_rdata_cmp(greater, lower) > 0, "rdata: cmp greater size.");
return 0;
}
......@@ -30,38 +30,38 @@
int main(int argc, char *argv[])
{
plan(31);
// Test init
knot_rdataset_t rdataset;
knot_rdataset_init(&rdataset);
ok(rdataset.data == NULL && rdataset.rr_count == 0, "rdataset: init.");
// Test rdata addition
knot_rdata_t rdata_gt[knot_rdata_array_size(4)];
knot_rdata_init(rdata_gt, 4, (uint8_t *)"wxyz", 3600);
int ret = knot_rdataset_add(NULL, NULL, NULL);
ok(ret == KNOT_EINVAL, "rdataset: add NULL.");
ret = knot_rdataset_add(&rdataset, rdata_gt, NULL);
bool add_ok = ret == KNOT_EOK && rdataset.rr_count == 1 &&
knot_rdata_cmp(rdata_gt, rdataset.data) == 0;
ok(add_ok, "rdataset: add.");
knot_rdata_t rdata_lo[knot_rdata_array_size(4)];
knot_rdata_init(rdata_lo, 4, (uint8_t *)"abcd", 3600);
ret = knot_rdataset_add(&rdataset, rdata_lo, NULL);
add_ok = ret == KNOT_EOK && rdataset.rr_count == 2 &&
knot_rdata_cmp(rdata_lo, rdataset.data) == 0;
ok(add_ok, "rdataset: add lower.");
// Test getters
ok(knot_rdata_cmp(knot_rdataset_at(&rdataset, 0), rdata_lo) == 0 &&
knot_rdata_cmp(knot_rdataset_at(&rdataset, 1), rdata_gt) == 0,
"rdataset: at.");
ok(knot_rdataset_size(&rdataset) == knot_rdata_array_size(4) * 2,
"rdataset: size.");
// Test copy
ok(knot_rdataset_copy(NULL, NULL, NULL) == KNOT_EINVAL,
"rdataset: copy NULL.");
......@@ -72,27 +72,27 @@ int main(int argc, char *argv[])
memcmp(rdataset.data, copy.data,
knot_rdataset_size(&rdataset)) == 0;
ok(copy_ok, "rdataset: copy");
// Test eq
ok(knot_rdataset_eq(&rdataset, &copy), "rdataset: equal");
// Test clear
knot_rdataset_clear(&copy, NULL);
ok(copy.rr_count == 0 && copy.data == NULL, "rdataset: clear.");
// Test not equal (different count)
ok(!knot_rdataset_eq(&rdataset, &copy), "rdataset: not equal - count");
// Test member
knot_rdata_t not_a_member[knot_rdata_array_size(1)];
knot_rdata_init(not_a_member, 1, (uint8_t *)"?", 3600);
ok(knot_rdataset_member(&rdataset, rdata_gt, true), "rdataset: is member.");
ok(!knot_rdataset_member(&rdataset, not_a_member, true), "rdataset: is not member.");
knot_rdata_set_ttl(rdata_gt, 1234);
ok(knot_rdataset_member(&rdataset, rdata_gt, false), "rdataset: is member TTL.");
ok(!knot_rdataset_member(&rdataset, rdata_gt, true), "rdataset: is not member TTL.");
// Test merge
ok(knot_rdataset_merge(NULL, NULL, NULL) == KNOT_EINVAL,
"rdataset: merge NULL.");
......@@ -106,9 +106,9 @@ int main(int argc, char *argv[])
merge_ok = ret == KNOT_EOK && rdataset.rr_count == 2 &&
data_before == rdataset.data;
ok(merge_ok, "rdataset: merge self.");
knot_rdataset_clear(&empty, NULL);
// Init structs for merge sort testing
knot_rdataset_t rdataset_lo; // "Lower" rdataset
knot_rdataset_init(&rdataset_lo);
......@@ -116,54 +116,54 @@ int main(int argc, char *argv[])
knot_rdataset_t rdataset_gt; // "Greater" rdataset
knot_rdataset_init(&rdataset_gt);
RDATASET_INIT_WITH(rdataset_gt, rdata_gt);
// Test not equal - different data
ok(!knot_rdataset_eq(&rdataset_gt, &rdataset_lo), "rdataset: data not equal.");
// Test that merge keeps the sorted order
ret = knot_rdataset_merge(&rdataset_lo, &rdataset_gt, NULL);
merge_ok = ret == KNOT_EOK && knot_rdataset_eq(&rdataset_lo, &rdataset);
ok(merge_ok, "rdataset: merge into lower.");
RDATASET_INIT_WITH(rdataset_lo, rdata_lo);
RDATASET_INIT_WITH(rdataset_gt, rdata_gt);
ret = knot_rdataset_merge(&rdataset_gt, &rdataset_lo, NULL);
merge_ok = ret == KNOT_EOK && knot_rdataset_eq(&rdataset_gt, &rdataset);
ok(merge_ok, "rdataset: merge into greater.");
// Test intersect
ok(knot_rdataset_intersect(NULL, NULL, NULL, NULL) == KNOT_EINVAL,
"rdataset: intersect NULL.");
knot_rdataset_t intersection;
ret = knot_rdataset_intersect(&rdataset, &rdataset, &intersection, NULL);
bool intersect_ok = ret == KNOT_EOK && knot_rdataset_eq(&rdataset, &intersection);
ok(intersect_ok, "rdataset: intersect self.");
knot_rdataset_clear(&intersection, NULL);
RDATASET_INIT_WITH(rdataset_lo, rdata_lo);
RDATASET_INIT_WITH(rdataset_gt, rdata_gt);
ret = knot_rdataset_intersect(&rdataset_lo, &rdataset_gt, &intersection, NULL);
intersect_ok = ret == KNOT_EOK && intersection.rr_count == 0;
ok(intersect_ok, "rdataset: intersect no common.");
ret = knot_rdataset_intersect(&rdataset, &rdataset_lo, &intersection, NULL);
intersect_ok = ret == KNOT_EOK && knot_rdataset_eq(&intersection, &rdataset_lo);
ok(intersect_ok, "rdataset: intersect normal.");