Skip to content

Commit

Permalink
Update tests to fix problem with negative integers when using older v…
Browse files Browse the repository at this point in the history
…ersions of protoc
  • Loading branch information
andersfugmann committed Apr 25, 2024
1 parent d314a9a commit 637f0cc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/enum_test.ml
Expand Up @@ -27,6 +27,6 @@ let%expect_test _ =
let%expect_test _ =
let module T = Enum.Negative in
let t = T.Enum.A3 in
Test_lib.test_encode ~proto_file (module T) t;
Test_lib.test_encode ~skip_json:true ~proto_file (module T) t;
[%expect {|
e: A3 |}]
2 changes: 1 addition & 1 deletion test/int_types_test.ml
Expand Up @@ -7,7 +7,7 @@ let test_signed (type t) ~(create : int -> t) (module T : Test_lib.T with type t
Printf.printf "Test %s\n%!" (T.name ());
let values = [-1073741823; -2; -1; 0; 1; 2; 1073741823] in
List.iter
~f:(fun v -> Test_lib.test_encode ~proto_file (module T) (create v))
~f:(fun v -> Test_lib.test_encode ~skip_json:true ~proto_file (module T) (create v))
values

let test_unsigned (type t) ~(create : int -> t) (module T : Test_lib.T with type t = t) =
Expand Down
4 changes: 2 additions & 2 deletions test/test_lib.ml
Expand Up @@ -130,8 +130,8 @@ let test_json ~debug ~proto_file (type t) (module M : T with type t = t) (t: t)
|> Reader.create
|> M.from_proto_exn
in
if t <> t' then Printf.printf "Deserialized json does not match.\n";
if t <> t'' then Printf.printf "Deserialized generated json does not match\n";
if not (M.equal t t') then Printf.printf "Deserialized json does not match.\n";
if not (M.equal t t'') then Printf.printf "Deserialized generated json does not match\n";
if (not (Yojson.Basic.equal json' json)) then
Printf.printf "Generated json not equal\n";

Expand Down

0 comments on commit 637f0cc

Please sign in to comment.