remove useless code in test helper

This commit is contained in:
Lesenechal Remi 2019-12-09 20:09:38 +01:00
parent 16fc55482d
commit 1c346ead28
3 changed files with 9 additions and 14 deletions

View File

@ -151,7 +151,7 @@ let get_entry (lst : program) (name : string) : (expression * int) result =
``` ```
let x = 42 in let x = 42 in
let y = 120 in let y = 120 in
const y = e -> e + (f ()) const f = () -> x + y
f(unit) f(unit)
``` ```

View File

@ -186,6 +186,7 @@ let higher_order () : unit result =
let%bind _ = expect_eq_n_int program "foobar3" make_expect in let%bind _ = expect_eq_n_int program "foobar3" make_expect in
let%bind _ = expect_eq_n_int program "foobar4" make_expect in let%bind _ = expect_eq_n_int program "foobar4" make_expect in
let%bind _ = expect_eq_n_int program "foobar5" make_expect in let%bind _ = expect_eq_n_int program "foobar5" make_expect in
(* let%bind _ = applies_expect_eq_n_int program "foobar5" make_expect in *)
ok () ok ()
let higher_order_mligo () : unit result = let higher_order_mligo () : unit result =

View File

@ -80,24 +80,18 @@ open Ast_simplified.Combinators
let typed_program_with_simplified_input_to_michelson let typed_program_with_simplified_input_to_michelson
(program: Ast_typed.program) (entry_point: string) (program: Ast_typed.program) (entry_point: string)
(input: Ast_simplified.expression) : (Compiler.compiled_expression * Tezos_utils.Michelson.michelson) result = (input: Ast_simplified.expression) : Compiler.compiled_expression result =
let env = Ast_typed.program_environment program in let env = Ast_typed.program_environment program in
let%bind (typed_in,_) = Compile.Of_simplified.compile_expression ~env ~state:(Typer.Solver.initial_state) input in let state = Typer.Solver.initial_state in
let%bind mini_c_in = Compile.Of_typed.compile_expression typed_in in let%bind (typed_in,_) = Compile.Of_simplified.compile_expression ~env ~state input in
(* might be useless *) let%bind mini_c_in = Compile.Of_typed.compile_expression typed_in in
let%bind michelson_in = Compile.Of_mini_c.compile_expression mini_c_in in
let%bind evaluated_in = Ligo.Run.Of_michelson.evaluate_expression michelson_in.expr michelson_in.expr_ty in
let%bind mini_c_prg = Compile.Of_typed.compile program in let%bind mini_c_prg = Compile.Of_typed.compile program in
let%bind michelson_program = Compile.Of_mini_c.aggregate_and_compile mini_c_prg (Some [mini_c_in]) entry_point in Compile.Of_mini_c.aggregate_and_compile mini_c_prg (Some [mini_c_in]) entry_point
ok (michelson_program, evaluated_in)
let run_typed_program_with_simplified_input ?options let run_typed_program_with_simplified_input ?options
(program: Ast_typed.program) (entry_point: string) (program: Ast_typed.program) (entry_point: string)
(input: Ast_simplified.expression) : Ast_simplified.expression result = (input: Ast_simplified.expression) : Ast_simplified.expression result =
let%bind (michelson_program, _evaluated_in) = typed_program_with_simplified_input_to_michelson program entry_point input in let%bind michelson_program = typed_program_with_simplified_input_to_michelson program entry_point input in
(* let%bind michelson_output = Ligo.Run.Of_michelson.run_contract
?options michelson_program.expr michelson_program.expr_ty _evaluated_in false in *)
let%bind michelson_output = Ligo.Run.Of_michelson.run ?options michelson_program.expr michelson_program.expr_ty in let%bind michelson_output = Ligo.Run.Of_michelson.run ?options michelson_program.expr michelson_program.expr_ty in
Uncompile.uncompile_typed_program_entry_function_result program entry_point michelson_output Uncompile.uncompile_typed_program_entry_function_result program entry_point michelson_output
@ -124,7 +118,7 @@ let expect_fail ?options program entry_point input =
run_typed_program_with_simplified_input ?options program entry_point input run_typed_program_with_simplified_input ?options program entry_point input
let expect_string_failwith ?options program entry_point input expected_failwith = let expect_string_failwith ?options program entry_point input expected_failwith =
let%bind (michelson_program, _evaluated_in) = typed_program_with_simplified_input_to_michelson program entry_point input in let%bind michelson_program = typed_program_with_simplified_input_to_michelson program entry_point input in
let%bind err = Ligo.Run.Of_michelson.run_failwith let%bind err = Ligo.Run.Of_michelson.run_failwith
?options michelson_program.expr michelson_program.expr_ty in ?options michelson_program.expr michelson_program.expr_ty in
match err with match err with