File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1
1
open Packet
2
2
open QuickCheck
3
+ open Arbitrary_Base
3
4
4
5
module Gen = QuickCheck_gen
5
6
@@ -104,6 +105,23 @@ module RoundTrip = struct
104
105
(packet_quickCheck (mk_ip tcp)
105
106
(prop_roundtrip2 parse marshal))
106
107
108
+ let addr_roundtrip parse marshal e =
109
+ (parse (marshal e)) = e
110
+
111
+ let addr_quickcheck arbitrary parse marshal =
112
+ let show (p1 ,p2 ) =
113
+ Format. sprintf " %Lu %Lu" p1 p2 in
114
+ let test = testable_fun arbitrary show testable_bool in
115
+ match quickCheck test (addr_roundtrip parse marshal) with
116
+ | Success -> true
117
+ | Failure _ -> failwith " No failure expected"
118
+ | Exhausted _ -> failwith " No exhaustion expected"
119
+
120
+ TEST " Roundtrip property for IPv6 Address" =
121
+ (addr_quickcheck arbitrary_uint128
122
+ ipv6_of_string string_of_ipv6)
123
+
124
+
107
125
end
108
126
109
127
Pa_ounit_lib.Runtime. summarize ()
You can’t perform that action at this time.
0 commit comments