diff mbox series

[2/6] unit: Update net_domain_list_parse test

Message ID 20220920133201.3303119-2-andrew.zaborowski@intel.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/6] net: Allow padding in net_domain_list_parse | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

Commit Message

Andrew Zaborowski Sept. 20, 2022, 1:31 p.m. UTC
---
 unit/test-net.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/unit/test-net.c b/unit/test-net.c
index ff5d2b0..f3f1522 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[])