add result.ml; polymorphic variant errors + refacto

This commit is contained in:
swrup 2026-03-26 06:23:42 +01:00 committed by Swrup
parent 9fd3b5a3cc
commit 42b0ec1445
36 changed files with 949 additions and 954 deletions

View file

@ -16,9 +16,9 @@ let test_eddsa () =
let open Eddsa in
let priv, pub = generate () in
let priv' = priv |> priv_to_octets |> priv_of_octets |> get_ok in
assert (priv_to_octets priv = priv_to_octets priv');
assert (priv = priv');
let pub' = pub |> pub_to_octets |> pub_of_octets |> get_ok in
assert (pub_to_octets pub = pub_to_octets pub');
assert (pub = pub');
()
let test_rsa () =
@ -53,9 +53,7 @@ let test_json () =
let test_amount () =
let open Amount in
let v =
make ~sign:(Some Sign_plus) ~currency:"KUDOS" ~value:(Int64.of_int 25)
~fraction:(Int32.of_int 678)
|> get_ok
make (Some Sign_plus) "KUDOS" (Int64.of_int 25) (Int32.of_int 678) |> get_ok
in
let v' = v |> to_string |> of_string |> get_ok in
assert (v = v');
@ -86,8 +84,7 @@ module Test_crypto = struct
|> Eddsa.priv_of_octets
|> get_ok
|> Eddsa.pub_of_priv
|> Eddsa.pub_to_octets
|> encode
|> Eddsa.pub_to_b32
in
assert (pub = pub')
@ -174,7 +171,7 @@ module Test_crypto = struct
rsa_pub
|> Rsa.pub_of_b32
|> get_ok
|> DenominationHash.hash_of_rsa
|> DenominationHash.hash
|> DenominationHash.to_b32
in
assert (h_pub' = h_pub)