aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Zaborowski <andrew.zaborowski@intel.com>2022-09-20 15:31:57 +0200
committerDenis Kenzior <denkenz@gmail.com>2022-09-20 10:02:41 -0500
commit9af15de31e6742c02045215e503890d9ab5636af (patch)
tree68692dd68cc4c938174ffc4b7b3fbd54e0f331c7
parentc79b047c99cfce63614a615e27ccd09ec4ed2748 (diff)
unit: Update net_domain_list_parse test
-rw-r--r--unit/test-net.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/unit/test-net.c b/unit/test-net.c
index ff5d2b01..f3f15223 100644
--- a/unit/test-net.c
+++ b/unit/test-net.c
@@ -113,11 +113,13 @@ static void test_net_domain_list_parse(const void *data)
static const uint8_t l1[] = { 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
3, 'c', 'o', 'm', 0,
4, 't', 'e', 's', 't', 0 };
- static const uint8_t l2[] = { 0, 0};
+ static const uint8_t l2[] = { 0, 0 };
static const uint8_t l3[] = { 4, '.', '=', '2', '3', 0 };
+ static const uint8_t l4[] = { 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
+ 3, 'c', 'o', 'm', 0, 0 };
char **domains;
- domains = net_domain_list_parse(l1, sizeof(l1));
+ domains = net_domain_list_parse(l1, sizeof(l1), false);
assert(domains);
assert(domains[0]);
assert(!strcmp(domains[0], "example.com"));
@@ -126,14 +128,21 @@ static void test_net_domain_list_parse(const void *data)
assert(!domains[2]);
l_strfreev(domains);
- assert(!net_domain_list_parse(l2, sizeof(l2)));
+ assert(!net_domain_list_parse(l2, sizeof(l2), false));
- domains = net_domain_list_parse(l3, sizeof(l3));
+ domains = net_domain_list_parse(l3, sizeof(l3), false);
assert(domains);
assert(domains[0]);
assert(!strcmp(domains[0], "\\.\\06123"));
assert(!domains[1]);
l_strfreev(domains);
+
+ domains = net_domain_list_parse(l4, sizeof(l4), true);
+ assert(domains);
+ assert(domains[0]);
+ assert(!strcmp(domains[0], "example.com"));
+ assert(!domains[1]);
+ l_strfreev(domains);
}
int main(int argc, char *argv[])