+ prop :: Int -> Property
+ prop x =
+ (0 <= x) && (x <= 255) ==>
+ fromEnum (toEnum x :: Octet) == x
+
+prop_read_show_inverses :: TestTree
+prop_read_show_inverses =
+ testProperty "read and show are inverses" prop
+ where
+ prop :: Int -> Property
+ prop x = (0 <= x) && (x <= 255) ==> x' == x
+ where
+ oct :: Octet
+ oct = read $ show x
+
+ x' :: Int
+ x' = read $ show oct