summaryrefslogtreecommitdiff
path: root/src/test/test-dns-domain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-dns-domain.c')
-rw-r--r--src/test/test-dns-domain.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/test/test-dns-domain.c b/src/test/test-dns-domain.c
index b76a31a549..f010e4e19a 100644
--- a/src/test/test-dns-domain.c
+++ b/src/test/test-dns-domain.c
@@ -126,7 +126,7 @@ static void test_dns_label_escape_one(const char *what, size_t l, const char *ex
_cleanup_free_ char *t = NULL;
int r;
- r = dns_label_escape(what, l, &t);
+ r = dns_label_escape_new(what, l, &t);
assert_se(r == ret);
if (r < 0)
@@ -246,21 +246,21 @@ static void test_dns_name_endswith(void) {
test_dns_name_endswith_one("x.y\001.z", "waldo", -EINVAL);
}
-static void test_dns_name_root(void) {
- assert_se(dns_name_root("") == true);
- assert_se(dns_name_root(".") == true);
- assert_se(dns_name_root("xxx") == false);
- assert_se(dns_name_root("xxx.") == false);
- assert_se(dns_name_root("..") == -EINVAL);
+static void test_dns_name_is_root(void) {
+ assert_se(dns_name_is_root(""));
+ assert_se(dns_name_is_root("."));
+ assert_se(!dns_name_is_root("xxx"));
+ assert_se(!dns_name_is_root("xxx."));
+ assert_se(!dns_name_is_root(".."));
}
-static void test_dns_name_single_label(void) {
- assert_se(dns_name_single_label("") == false);
- assert_se(dns_name_single_label(".") == false);
- assert_se(dns_name_single_label("..") == -EINVAL);
- assert_se(dns_name_single_label("x") == true);
- assert_se(dns_name_single_label("x.") == true);
- assert_se(dns_name_single_label("xx.yy") == false);
+static void test_dns_name_is_single_label(void) {
+ assert_se(!dns_name_is_single_label(""));
+ assert_se(!dns_name_is_single_label("."));
+ assert_se(!dns_name_is_single_label(".."));
+ assert_se(dns_name_is_single_label("x"));
+ assert_se(dns_name_is_single_label("x."));
+ assert_se(!dns_name_is_single_label("xx.yy"));
}
static void test_dns_name_reverse_one(const char *address, const char *name) {
@@ -327,27 +327,27 @@ static void test_dns_service_name_is_valid(void) {
assert_se(!dns_service_name_is_valid("this is an overly long string that is certainly longer than 63 characters"));
}
-static void test_dns_srv_type_verify(void) {
+static void test_dns_srv_type_is_valid(void) {
- assert_se(dns_srv_type_verify("_http._tcp") > 0);
- assert_se(dns_srv_type_verify("_foo-bar._tcp") > 0);
- assert_se(dns_srv_type_verify("_w._udp") > 0);
- assert_se(dns_srv_type_verify("_a800._tcp") > 0);
- assert_se(dns_srv_type_verify("_a-800._tcp") > 0);
+ assert_se(dns_srv_type_is_valid("_http._tcp"));
+ assert_se(dns_srv_type_is_valid("_foo-bar._tcp"));
+ assert_se(dns_srv_type_is_valid("_w._udp"));
+ assert_se(dns_srv_type_is_valid("_a800._tcp"));
+ assert_se(dns_srv_type_is_valid("_a-800._tcp"));
- assert_se(dns_srv_type_verify(NULL) == 0);
- assert_se(dns_srv_type_verify("") == 0);
- assert_se(dns_srv_type_verify("x") == 0);
- assert_se(dns_srv_type_verify("_foo") == 0);
- assert_se(dns_srv_type_verify("_tcp") == 0);
- assert_se(dns_srv_type_verify("_") == 0);
- assert_se(dns_srv_type_verify("_foo.") == 0);
- assert_se(dns_srv_type_verify("_föo._tcp") == 0);
- assert_se(dns_srv_type_verify("_f\no._tcp") == 0);
- assert_se(dns_srv_type_verify("_800._tcp") == 0);
- assert_se(dns_srv_type_verify("_-800._tcp") == 0);
- assert_se(dns_srv_type_verify("_-foo._tcp") == 0);
- assert_se(dns_srv_type_verify("_piep._foo._udp") == 0);
+ assert_se(!dns_srv_type_is_valid(NULL));
+ assert_se(!dns_srv_type_is_valid(""));
+ assert_se(!dns_srv_type_is_valid("x"));
+ assert_se(!dns_srv_type_is_valid("_foo"));
+ assert_se(!dns_srv_type_is_valid("_tcp"));
+ assert_se(!dns_srv_type_is_valid("_"));
+ assert_se(!dns_srv_type_is_valid("_foo."));
+ assert_se(!dns_srv_type_is_valid("_föo._tcp"));
+ assert_se(!dns_srv_type_is_valid("_f\no._tcp"));
+ assert_se(!dns_srv_type_is_valid("_800._tcp"));
+ assert_se(!dns_srv_type_is_valid("_-800._tcp"));
+ assert_se(!dns_srv_type_is_valid("_-foo._tcp"));
+ assert_se(!dns_srv_type_is_valid("_piep._foo._udp"));
}
static void test_dns_service_join_one(const char *a, const char *b, const char *c, int r, const char *d) {
@@ -436,14 +436,14 @@ int main(int argc, char *argv[]) {
test_dns_name_equal();
test_dns_name_endswith();
test_dns_name_between();
- test_dns_name_root();
- test_dns_name_single_label();
+ test_dns_name_is_root();
+ test_dns_name_is_single_label();
test_dns_name_reverse();
test_dns_name_concat();
test_dns_name_is_valid();
test_dns_name_to_wire_format();
test_dns_service_name_is_valid();
- test_dns_srv_type_verify();
+ test_dns_srv_type_is_valid();
test_dns_service_join();
test_dns_service_split();
test_dns_name_change_suffix();