+ -- We declare the big number as Word32 because otherwise, on x86,
+ -- we get a warning that it's too big to fit in a 32-bit integer.
+ -- Ultimately we convert it to a (negative) Int on those systems
+ -- anyway, but the gymnastics declare our intent to the compiler.
+ actual = toEnum (fromIntegral (3232235520 :: Word32)) :: 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