]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add tests for combo-ip comparisons
authorAlan T. DeKok <aland@freeradius.org>
Thu, 7 Dec 2023 17:32:59 +0000 (12:32 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 7 Dec 2023 17:35:34 +0000 (12:35 -0500)
src/tests/unit/calc.txt

index a63f254dcffab23ad8b611228321d6d64a60a16b..1418d418b4e164e973f0c82223de0a58a9bcfc20 100644 (file)
@@ -143,6 +143,33 @@ match 2001:d00::/24
 calc ipv6addr 2001:DB8::1 & octets 0xffffffff000000000000000000000000
 match 2001:db8::/32
 
+#
+#  Comparisons
+#
+calc ipv4prefix 127/8 > ipv4addr 127.0.0.1 -> bool
+match yes
+
+calc ipv4prefix 127/8 > ipv4addr 192.168.0.1 -> bool
+match no
+
+#
+#  combo-ip
+#
+calc combo-prefix 127/8 > ipv4addr 127.0.0.1 -> bool
+match yes
+
+calc combo-prefix 127/8 > ipv4addr 192.168.0.1 -> bool
+match no
+
+calc combo-prefix 127/8 > combo-ip 127.0.0.1 -> bool
+match yes
+
+calc combo-prefix 127/8 > combo-ip 192.168.0.1 -> bool
+match no
+
+calc combo-prefix 127/8 > ipv6addr 2001:DB8::1 -> bool
+match Cannot compare IPv4 with IPv6 address
+
 ######################################################################
 #
 #  Float
@@ -173,4 +200,4 @@ calc string "2" += string "test"
 match 2test
 
 count
-match 76
+match 90