@@ -5,7 +5,7 @@ let proto_file = "int_types_native.proto"
55
66let test_signed64 (type t ) ~(create : Int64.t -> t ) (module T : Test_lib.T with type t = t ) =
77 Printf. printf " Test %s\n %!" (T. name () );
8- let values = [- 1073741823L ; - 2L ; - 1L ; 0L ; 1L ; 2L ; 1073741823L ] in
8+ let values = [Int64. min_int; Int64. succ Int64. min_int; - 1073741823L ; - 2L ; - 1L ; 0L ; 1L ; 2L ; 1073741823L ; Int64. pred Int64. max_int; Int64. max_int ] in
99 List. iter
1010 ~f: (fun v -> Test_lib. test_encode ~proto_file (module T ) (create v))
1111 values
@@ -19,7 +19,7 @@ let test_unsigned64 (type t) ~(create : Int64.t -> t) (module T : Test_lib.T wit
1919
2020let test_signed32 (type t ) ~(create : Int32.t -> t ) (module T : Test_lib.T with type t = t ) =
2121 Printf. printf " Test %s\n %!" (T. name () );
22- let values = [- 1073741823l ; - 2l ; - 1l ; 0l ; 1l ; 2l ; 1073741823l ] in
22+ let values = [Int32. min_int; Int32. succ Int32. min_int; - 1073741823l ; - 2l ; - 1l ; 0l ; 1l ; 2l ; 1073741823l ; Int32. pred Int32. max_int; Int32. max_int ] in
2323 List. iter
2424 ~f: (fun v -> Test_lib. test_encode ~proto_file (module T ) (create v))
2525 values
@@ -37,38 +37,53 @@ let%expect_test _ =
3737 test_signed64 ~create (module T );
3838 [% expect {|
3939 Test .int_types_native.SInt64
40+ i : - 9223372036854775808
41+ i : - 9223372036854775807
4042 i : - 1073741823
4143 i : - 2
4244 i : - 1
4345 i : 1
4446 i : 2
45- i : 1073741823 |}]
47+ i : 1073741823
48+ i : 9223372036854775806
49+ i : 9223372036854775807
50+ |}]
4651
4752let % expect_test _ =
4853 let module T = Int_types_native. SInt32 in
4954 let create i = i in
5055 test_signed32 ~create (module T );
5156 [% expect {|
5257 Test .int_types_native.SInt32
58+ i : - 2147483648
59+ i : - 2147483647
5360 i : - 1073741823
5461 i : - 2
5562 i : - 1
5663 i : 1
5764 i : 2
58- i : 1073741823 |}]
65+ i : 1073741823
66+ i : 2147483646
67+ i : 2147483647
68+ |}]
5969
6070let % expect_test _ =
6171 let module T = Int_types_native. Int64 in
6272 let create i = i in
6373 test_signed64 ~create (module T );
6474 [% expect {|
6575 Test .int_types_native.Int64
76+ i : - 9223372036854775808
77+ i : - 9223372036854775807
6678 i : - 1073741823
6779 i : - 2
6880 i : - 1
6981 i : 1
7082 i : 2
71- i : 1073741823 |}]
83+ i : 1073741823
84+ i : 9223372036854775806
85+ i : 9223372036854775807
86+ |}]
7287
7388let % expect_test _ =
7489 let module T = Int_types_native. Int32 in
@@ -77,12 +92,17 @@ let%expect_test _ =
7792 [% expect
7893 {|
7994 Test .int_types_native.Int32
95+ i : - 2147483648
96+ i : - 2147483647
8097 i : - 1073741823
8198 i : - 2
8299 i : - 1
83100 i : 1
84101 i : 2
85- i : 1073741823 |}]
102+ i : 1073741823
103+ i : 2147483646
104+ i : 2147483647
105+ |}]
86106
87107let % expect_test _ =
88108 let module T = Int_types_native. UInt64 in
0 commit comments