emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 6d8e758: Add nsm-should-check IPv6 local subnet tests


From: Robert Pluim
Subject: master 6d8e758: Add nsm-should-check IPv6 local subnet tests
Date: Fri, 29 Nov 2019 10:41:16 -0500 (EST)

branch: master
commit 6d8e758e85d0662775b27111289aa199e0d0a46f
Author: Robert Pluim <address@hidden>
Commit: Robert Pluim <address@hidden>

    Add nsm-should-check IPv6 local subnet tests
    
    * test/lisp/net/nsm-tests.el (nsm-check-local-subnet-ipv6): Now
    that IPv6 addresses are returned from network-interface-list, test
    nsm-should check and nsm-network-same-subnet for IPv6 as well.
---
 test/lisp/net/nsm-tests.el | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/test/lisp/net/nsm-tests.el b/test/lisp/net/nsm-tests.el
index f354437..97edcca 100644
--- a/test/lisp/net/nsm-tests.el
+++ b/test/lisp/net/nsm-tests.el
@@ -49,9 +49,6 @@
       (should (eq nil (nsm-should-check "127.0.0.1")))
       (should (eq nil (nsm-should-check "localhost"))))))
 
-;; FIXME This will never return true, since
-;; network-interface-list only gives the primary address of each
-;; interface, which will be the IPv4 one
 (defun nsm-ipv6-is-available ()
   (and (featurep 'make-network-process '(:family ipv6))
        (cl-rassoc-if
@@ -61,6 +58,17 @@
 
 (ert-deftest nsm-check-local-subnet-ipv6 ()
   (skip-unless (nsm-ipv6-is-available))
+  (let ((local-ip '[123 456 789 11 172 26 128 160 0])
+        (mask '[255 255 255 255 255 255 255 0 0])
+
+        (wrong-length-mask '[255 255 255 255 255 255 255])
+        (wrong-mask '[255 255 255 255 255 255 255 255 0])
+        (remote-ip-yes '[123 456 789 11 172 26 128 161 0])
+        (remote-ip-no '[123 456 789 11 172 26 129 161 0]))
+    (should (eq t (nsm-network-same-subnet local-ip mask remote-ip-yes)))
+    (should (eq nil (nsm-network-same-subnet local-ip mask remote-ip-no)))
+    (should-error (nsm-network-same-subnet local-ip wrong-length-mask 
remote-ip-yes))
+    (should (eq nil (nsm-network-same-subnet local-ip wrong-mask 
remote-ip-yes))))
   (should (eq t (nsm-should-check "::1")))
   (let ((nsm-trust-local-network t))
     (should (eq nil (nsm-should-check "::1")))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]