module Cidr
( Cidr(..),
cidr_from_string,
+ cidr_tests,
combine_all
) where
import Data.List (nubBy)
+import Test.HUnit
import IPv4Address
import ListUtils
addr2 = ipv4address cidr2
mbits1 = maskbits cidr1
mbits2 = maskbits cidr2
+
+
+
+
+
+-- HUnit Tests
+
+test_contains =
+ TestCase $ assertEqual "10.1.1.0/23 contains 10.1.1.0/24" (cidr1 `contains` cidr2) True
+ where
+ cidr1 = cidr_from_string "10.1.1.0/23"
+ cidr2 = cidr_from_string "10.1.1.0/24"
+
+
+cidr_tests = [ test_contains ]