+
+
+
+-- HUnit Tests
+mk_testaddr :: Int -> Int -> Int -> Int -> IPv4Address
+mk_testaddr a b c d =
+ IPv4Address oct1 oct2 oct3 oct4
+ where
+ oct1 = octet_from_int a
+ oct2 = octet_from_int b
+ oct3 = octet_from_int c
+ oct4 = octet_from_int d
+
+
+test_most_sig_bit_different1 =
+ TestCase $ assertEqual "10.1.1.0 and 10.1.0.0 differ in bit 24" TwentyFour (most_sig_bit_different (mk_testaddr 10 1 1 0) (mk_testaddr 10 1 0 0))
+
+
+test_most_sig_bit_different2 =
+ TestCase $ assertEqual "10.1.2.0 and 10.1.1.0 differ in bit 23" TwentyThree (most_sig_bit_different (mk_testaddr 10 1 2 0) (mk_testaddr 10 1 1 0))
+
+
+
+ipv4address_tests = [ test_most_sig_bit_different1,
+ test_most_sig_bit_different2 ]