test passed

This commit is contained in:
Pierre-Emmanuel Wulfman 2020-03-12 23:24:10 +01:00
parent 2abd737ed3
commit 6dfd2dac32
12 changed files with 66 additions and 46 deletions

View File

@ -4,7 +4,9 @@ open Trace
open Test_helpers
let type_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
ok @@ (typed,state)
@ -20,10 +22,9 @@ let get_program =
)
let compile_main () =
let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/coase.ligo" (Syntax_name "pascaligo") in
let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind typed_prg = get_program () in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind (_contract: Tezos_utils.Michelson.michelson) =
(* fails if the given entry point is not a valid contract *)
Ligo.Compile.Of_michelson.build_contract michelson_prg in

View File

@ -3,7 +3,9 @@ open Test_helpers
open Ast_simplified
let type_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
ok @@ (typed,state)
@ -18,10 +20,9 @@ let get_program =
)
let compile_main () =
let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/hashlock.mligo" (Syntax_name "cameligo") in
let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind typed_prg,_ = get_program () in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind (_contract: Tezos_utils.Michelson.michelson) =
(* fails if the given entry point is not a valid contract *)
Ligo.Compile.Of_michelson.build_contract michelson_prg in

View File

@ -4,7 +4,9 @@ open Ast_simplified
let mtype_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
ok (typed,state)
@ -19,8 +21,7 @@ let get_program =
)
let compile_main () =
let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/id.mligo" (Syntax_name "cameligo") in
let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
let%bind typed_prg,_ = get_program () in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind (_contract: Tezos_utils.Michelson.michelson) =

View File

@ -4,18 +4,24 @@ open Test_helpers
open Ast_simplified.Combinators
let retype_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "reasonligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "reasonligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile Env simplified in
let () = Typer.Solver.discard_state state in
let () = Typer.Solver.discard_state state in
ok typed
let mtype_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile Env simplified in
let () = Typer.Solver.discard_state state in
ok typed
let type_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile Env simplified in
let () = Typer.Solver.discard_state state in
ok typed

View File

@ -68,7 +68,9 @@ let compile_groups _filename grp_list =
(fun ((s,grp),contents) ->
trace (failed_to_compile_md_file _filename (s,grp,contents)) @@
let%bind v_syntax = Compile.Helpers.syntax_to_variant (Syntax_name s) None in
let%bind simplified = Compile.Of_source.compile_string contents v_syntax in
let%bind abstracted = Compile.Of_source.compile_string contents v_syntax in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,_ = Compile.Of_simplified.compile Env simplified in
let%bind mini_c = Compile.Of_typed.compile typed in
bind_map_list

View File

@ -6,7 +6,9 @@ let mfile = "./contracts/multisig.mligo"
let refile = "./contracts/multisig.religo"
let type_file f s =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name s) in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name s) in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
ok @@ (typed,state)
@ -175,12 +177,12 @@ let main = test_suite "Multisig" [
test "valid_2_of_3 (mligo)" (valid_2_of_3 mfile "cameligo");
test "invalid_3_of_3 (mligo)" (invalid_3_of_3 mfile "cameligo");
test "not_enough_2_of_3 (mligo)" (not_enough_2_of_3 mfile "cameligo");
test "compile (religo)" (compile_main refile "reasonligo");
test "compile (religo)" (compile_main refile "reasonligo");
test "unmatching_counter (religo)" (unmatching_counter refile "reasonligo");
test "valid_1_of_1 (religo)" (valid_1_of_1 refile "reasonligo");
test "invalid_1_of_1 (religo)" (invalid_1_of_1 refile "reasonligo");
test "not_enough_signature (religo)" (not_enough_1_of_2 refile "reasonligo");
test "valid_2_of_3 (religo)" (valid_2_of_3 refile "reasonligo");
test "invalid_3_of_3 (religo)" (invalid_3_of_3 refile "reasonligo");
test "not_enough_2_of_3 (religo)" (not_enough_2_of_3 refile "reasonligo");
test "valid_1_of_1 (religo)" (valid_1_of_1 refile "reasonligo");
test "invalid_1_of_1 (religo)" (invalid_1_of_1 refile "reasonligo");
test "not_enough_signature (religo)" (not_enough_1_of_2 refile "reasonligo");
test "valid_2_of_3 (religo)" (valid_2_of_3 refile "reasonligo");
test "invalid_3_of_3 (religo)" (invalid_3_of_3 refile "reasonligo");
test "not_enough_2_of_3 (religo)" (not_enough_2_of_3 refile "reasonligo");
]

View File

@ -2,7 +2,9 @@ open Trace
open Test_helpers
let type_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
ok @@ (typed,state)
@ -17,10 +19,9 @@ let get_program =
)
let compile_main () =
let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/multisig-v2.ligo" (Syntax_name "pascaligo") in
let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind typed_prg,_ = get_program () in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind (_contract: Tezos_utils.Michelson.michelson) =
(* fails if the given entry point is not a valid contract *)
Ligo.Compile.Of_michelson.build_contract michelson_prg in
@ -35,7 +36,7 @@ let empty_message = e_lambda (Var.of_name "arguments")
empty_op_list
let empty_message2 = e_lambda (Var.of_name "arguments")
(Some t_bytes) (Some (t_list t_operation))
( e_let_in ((Var.of_name "foo"),Some t_unit) false false (e_unit ()) empty_op_list)
( e_let_in ((Var.of_name "foo"),Some t_unit) false (e_unit ()) empty_op_list)
let send_param msg = e_constructor "Send" msg
let withdraw_param = e_constructor "Withdraw" empty_message

View File

@ -4,7 +4,9 @@ open Ast_simplified
let retype_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "reasonligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "reasonligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile Env simplified in
ok (typed,state)
@ -19,10 +21,9 @@ let get_program =
)
let compile_main () =
let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/pledge.religo" (Syntax_name "reasonligo") in
let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile Env simplified in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind typed_prg,_ = get_program () in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind (_contract: Tezos_utils.Michelson.michelson) =
(* fails if the given entry point is not a valid contract *)
Ligo.Compile.Of_michelson.build_contract michelson_prg in

View File

@ -2,7 +2,9 @@ open Trace
open Test_helpers
let type_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
ok @@ (typed,state)
@ -17,8 +19,7 @@ let get_program =
)
let compile_main () =
let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/replaceable_id.ligo" (Syntax_name "pascaligo") in
let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
let%bind typed_prg,_ = get_program () in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind (_contract: Tezos_utils.Michelson.michelson) =

View File

@ -3,7 +3,9 @@ open Test_helpers
open Ast_simplified
let type_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
ok @@ (typed,state)
@ -18,8 +20,7 @@ let get_program =
)
let compile_main () =
let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/timelock_repeat.mligo" (Syntax_name "cameligo") in
let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
let%bind typed_prg,_ = type_file "./contracts/timelock_repeat.mligo" in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind (_contract: Tezos_utils.Michelson.michelson) =

View File

@ -2,7 +2,9 @@ open Trace
open Test_helpers
let type_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "pascaligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
ok @@ (typed,state)
@ -17,8 +19,7 @@ let get_program =
)
let compile_main () =
let%bind simplified = Ligo.Compile.Of_source.compile "./contracts/time-lock.ligo" (Syntax_name "pascaligo") in
let%bind typed_prg,_ = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
let%bind typed_prg,_ = type_file "./contracts/time-lock.ligo" in
let%bind mini_c_prg = Ligo.Compile.Of_typed.compile typed_prg in
let%bind michelson_prg = Ligo.Compile.Of_mini_c.aggregate_and_compile_contract mini_c_prg "main" in
let%bind (_contract: Tezos_utils.Michelson.michelson) =

View File

@ -2,7 +2,9 @@ open Trace
open Test_helpers
let type_file f =
let%bind simplified = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind abstracted = Ligo.Compile.Of_source.compile f (Syntax_name "cameligo") in
let%bind complex = Ligo.Compile.Of_abstracted.compile abstracted in
let%bind simplified = Ligo.Compile.Of_complex.compile complex in
let%bind typed,state = Ligo.Compile.Of_simplified.compile (Contract "main") simplified in
ok @@ (typed,state)