Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1788?usp=email

to review the following change.


Change subject: tests: cover subnet_pool6_by_tag
......................................................................

tests: cover subnet_pool6_by_tag

Extend the subnet-pool unit test with the IPv6 tag lookup, mirroring the
IPv4 case.

Change-Id: I37793543cd026aa4917129710c085c808e648c60
GitHub: closes openvpn/OpenVPN#987
Signed-off-by: Antonio Quartulli <[email protected]>
---
M tests/unit_tests/openvpn/test_subnet_pool.c
1 file changed, 18 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/88/1788/1

diff --git a/tests/unit_tests/openvpn/test_subnet_pool.c 
b/tests/unit_tests/openvpn/test_subnet_pool.c
index 8e73b64..d01ce05 100644
--- a/tests/unit_tests/openvpn/test_subnet_pool.c
+++ b/tests/unit_tests/openvpn/test_subnet_pool.c
@@ -60,8 +60,26 @@
     assert_null(subnet_pool_by_tag(NULL, "grpA"));
 }

+/* the IPv6 counterpart resolves independently: a tag may name a v4 pool, a
+ * v6 pool, or both. */
+static void
+test_subnet_pool6_by_tag(void **state)
+{
+    struct subnet_pool6_def c = { .next = NULL, .tag = "grpC", .netbits = 64 };
+    struct subnet_pool6_def b = { .next = &c, .tag = "grpB", .netbits = 96 };
+    struct subnet_pool6_def a = { .next = &b, .tag = "grpA", .netbits = 64 };
+
+    assert_ptr_equal(subnet_pool6_by_tag(&a, "grpA"), &a);
+    assert_ptr_equal(subnet_pool6_by_tag(&a, "grpB"), &b);
+    assert_ptr_equal(subnet_pool6_by_tag(&a, "grpC"), &c);
+    assert_int_equal(subnet_pool6_by_tag(&a, "grpB")->netbits, 96);
+    assert_null(subnet_pool6_by_tag(&a, "nope"));
+    assert_null(subnet_pool6_by_tag(NULL, "grpA"));
+}
+
 const struct CMUnitTest subnet_pool_tests[] = {
     cmocka_unit_test(test_subnet_pool_by_tag),
+    cmocka_unit_test(test_subnet_pool6_by_tag),
 };

 int

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1788?usp=email
To unsubscribe, or for help writing mail filters, visit 
http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I37793543cd026aa4917129710c085c808e648c60
Gerrit-Change-Number: 1788
Gerrit-PatchSet: 1
Gerrit-Owner: ordex <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to