summaryrefslogtreecommitdiffstats
path: root/tests/libknot/test_rdata.c
diff options
context:
space:
mode:
authorDaniel Salzman <daniel.salzman@nic.cz>2017-11-06 16:44:44 +0100
committerDaniel Salzman <daniel.salzman@nic.cz>2017-12-05 15:29:00 +0100
commitf942ad65bf5d4f45eb2fb78d44c4a6eeacaa0b08 (patch)
tree2008c8b02727fd55cd5f43481e2754d39101bb80 /tests/libknot/test_rdata.c
parentlibknot/rdata: make it public structure (diff)
downloadknot-f942ad65bf5d4f45eb2fb78d44c4a6eeacaa0b08.tar.xz
knot-f942ad65bf5d4f45eb2fb78d44c4a6eeacaa0b08.zip
rdata: remove superfluous getters/setters
Diffstat (limited to 'tests/libknot/test_rdata.c')
-rw-r--r--tests/libknot/test_rdata.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/tests/libknot/test_rdata.c b/tests/libknot/test_rdata.c
index a6c6aebde..094cc4d26 100644
--- a/tests/libknot/test_rdata.c
+++ b/tests/libknot/test_rdata.c
@@ -33,16 +33,12 @@ int main(int argc, char *argv[])
knot_rdata_t *rdata = (knot_rdata_t *)buf1;
uint8_t payload[] = "abcdefghijklmnop";
knot_rdata_init(rdata, data_size, payload);
- const bool set_ok = knot_rdata_rdlen(rdata) == data_size &&
- memcmp(knot_rdata_data(rdata), payload, data_size) == 0;
+ const bool set_ok = rdata->len == data_size &&
+ memcmp(rdata->data, payload, data_size) == 0;
ok(set_ok, "rdata: init.");
- // Test setters
- knot_rdata_set_rdlen(rdata, 1);
- ok(knot_rdata_rdlen(rdata) == 1, "rdata: set RDLEN.");
-
// Test compare
- knot_rdata_set_rdlen(rdata, data_size);
+ rdata->len = data_size;
ok(knot_rdata_cmp(rdata, rdata) == 0, "rdata: cmp eq.");
knot_rdata_t *lower = rdata;
@@ -53,10 +49,10 @@ int main(int argc, char *argv[])
ok(knot_rdata_cmp(greater, lower) > 0, "rdata: cmp greater.");
// Payloads will be the same.
- memcpy(knot_rdata_data(greater), knot_rdata_data(lower), data_size);
+ memcpy(greater->data, lower->data, data_size);
assert(knot_rdata_cmp(lower, greater) == 0);
- knot_rdata_set_rdlen(lower, data_size - 1);
+ lower->len = data_size - 1;
ok(knot_rdata_cmp(lower, greater) < 0, "rdata: cmp lower size.");
ok(knot_rdata_cmp(greater, lower) > 0, "rdata: cmp greater size.");