test_minBound,
test_most_sig_bit_different1,
test_most_sig_bit_different2,
+ test_ord_instance1,
+ test_ord_instance2,
+ test_ord_instance3,
+ test_ord_instance4,
test_to_enum ]
ipv4address_properties :: TestTree
desc = "192.168.0.0 in base-10 is 3232235520"
expected = mk_testaddr 192 168 0 0
actual = toEnum 3232235520 :: IPv4Address
+
+
+test_ord_instance1 :: TestTree
+test_ord_instance1 =
+ testCase desc $ actual @?= expected
+ where
+ desc = "127.0.0.0 is less than 127.0.0.1"
+ addr1 = mk_testaddr 127 0 0 0
+ addr2 = mk_testaddr 127 0 0 1
+ expected = True
+ actual = addr1 <= addr2
+
+
+test_ord_instance2 :: TestTree
+test_ord_instance2 =
+ testCase desc $ actual @?= expected
+ where
+ desc = "127.0.0.0 is less than 127.0.1.0"
+ addr1 = mk_testaddr 127 0 0 0
+ addr2 = mk_testaddr 127 0 1 0
+ expected = True
+ actual = addr1 <= addr2
+
+test_ord_instance3 :: TestTree
+test_ord_instance3 =
+ testCase desc $ actual @?= expected
+ where
+ desc = "127.0.0.0 is less than 127.1.0.0"
+ addr1 = mk_testaddr 127 0 0 0
+ addr2 = mk_testaddr 127 1 0 0
+ expected = True
+ actual = addr1 <= addr2
+
+test_ord_instance4 :: TestTree
+test_ord_instance4 =
+ testCase desc $ actual @?= expected
+ where
+ desc = "127.0.0.0 is less than 128.0.0.0"
+ addr1 = mk_testaddr 127 0 0 0
+ addr2 = mk_testaddr 128 0 0 0
+ expected = True
+ actual = addr1 <= addr2