Expose tez mod tez, too
This commit is contained in:
parent
d87d0aab73
commit
e672d10029
@ -445,6 +445,8 @@ module Typer = struct
|
||||
let mod_ = typer_2 "MOD" @@ fun a b ->
|
||||
if (eq_1 a (t_nat ()) || eq_1 a (t_int ())) && (eq_1 b (t_nat ()) || eq_1 b (t_int ()))
|
||||
then ok @@ t_nat () else
|
||||
if eq_1 a (t_tez ()) && eq_1 b (t_tez ())
|
||||
then ok @@ t_tez () else
|
||||
simple_fail "Computing modulo with wrong types"
|
||||
|
||||
let add = typer_2 "ADD" @@ fun a b ->
|
||||
|
@ -10,3 +10,7 @@ const tez_mul_nat : tez = 100mtz * 10n;
|
||||
const tez_div_tez1 : nat = 100mtz / 1mtz;
|
||||
const tez_div_tez2 : nat = 100mtz / 90mtz;
|
||||
const tez_div_tez3 : nat = 100mtz / 110mtz;
|
||||
|
||||
const tez_mod_tez1 : tez = 100mtz mod 1mtz;
|
||||
const tez_mod_tez2 : tez = 100mtz mod 90mtz;
|
||||
const tez_mod_tez3 : tez = 100mtz mod 110mtz;
|
||||
|
@ -834,6 +834,9 @@ let tez_ligo () : unit result =
|
||||
let%bind _ = expect_eq_evaluate program "tez_div_tez1" (e_nat 100) in
|
||||
let%bind _ = expect_eq_evaluate program "tez_div_tez2" (e_nat 1) in
|
||||
let%bind _ = expect_eq_evaluate program "tez_div_tez3" (e_nat 0) in
|
||||
let%bind _ = expect_eq_evaluate program "tez_mod_tez1" (e_mutez 0) in
|
||||
let%bind _ = expect_eq_evaluate program "tez_mod_tez2" (e_mutez 10) in
|
||||
let%bind _ = expect_eq_evaluate program "tez_mod_tez3" (e_mutez 100) in
|
||||
ok ()
|
||||
|
||||
let tez_mligo () : unit result =
|
||||
|
Loading…
Reference in New Issue
Block a user