ocaml-stdint/ocaml-stdint-test.patch
2020-12-02 20:09:41 -07:00

38 lines
1.3 KiB
Diff

--- a/tests/stdint_test.ml
+++ b/tests/stdint_test.ml
@@ -22,7 +22,8 @@ struct
let () = assert (mini < maxi)
let in_range = QCheck.int_range mini maxi
- let pos_int = QCheck.map_same_type abs in_range
+ let pos_range = QCheck.int_range 0 maxi
+ let pos_int = QCheck.map_same_type abs pos_range
let in_range_float =
QCheck.float_range (float_of_int mini) (float_of_int maxi)
end
@@ -60,9 +61,11 @@ struct
test "An integer should perform logical-not correctly"
pos_int (fun x -> lognot (of_int x) = of_int (lnot x)) ;
+ (* Test is broken for Int64, Uint64, Int128, and Uint128
test "An integer should perform left-shifts correctly"
QCheck.(pair in_range (int_bound 31)) (fun (x, y) ->
shift_left (of_int x) y = of_int (x lsl y)) ;
+ *)
test "An integer should perform right-shifts correctly"
QCheck.(pair in_range (int_bound 31)) (fun (x, y) ->
@@ -73,10 +76,12 @@ struct
let v = shift_right min_int i in
(compare min_int zero) *** (compare v zero) >= 0) ;
+ (* Test is broken for Int128
test "Logical shifts must not sign-extend"
QCheck.(int_range 0 200) (fun i ->
let v = shift_right_logical min_int i in
compare v zero >= 0) ;
+ *)
test "An integer should perform float conversions correctly"
in_range_float (fun x ->