fixed last bug

This commit is contained in:
galfour 2019-08-21 11:41:57 +02:00
parent af588933f4
commit 31a2a96810
4 changed files with 15 additions and 15 deletions

View File

@ -300,7 +300,7 @@ and translate_expression (expr:expression) (env:environment) : michelson result
| "ITER" -> (
let%bind code = ok (seq [
expr' ;
i_iter (seq [body' ; dip i_drop]) ;
i_iter (seq [body' ; i_drop ; i_drop]) ;
i_push_unit ;
]) in
return code

View File

@ -0,0 +1,9 @@
function iter_op (const s : set(int)) : int is
var r : int := 0 ;
function aggregate (const i : int) : unit is
begin
r := r + i ;
end with unit
begin
set_iter(s , aggregate) ;
end with r

View File

@ -1,13 +1,3 @@
function iter_op (const s : set(int)) : int is
var r : int := 0 ;
function aggregate (const i : int) : unit is
begin
r := r + i ;
end with unit
begin
set_iter(s , aggregate) ;
end with r
const s_e : set(string) = (set_empty : set(string))
const s_fb : set(string) = set [

View File

@ -167,6 +167,11 @@ let string_arithmetic () : unit result =
let set_arithmetic () : unit result =
let%bind program = type_file "./contracts/set_arithmetic.ligo" in
let%bind program_1 = type_file "./contracts/set_arithmetic-1.ligo" in
let%bind () =
expect_eq program_1 "iter_op"
(e_set [e_int 2 ; e_int 4 ; e_int 7])
(e_int 13) in
let%bind () =
expect_eq program "add_op"
(e_set [e_string "foo" ; e_string "bar"])
@ -191,10 +196,6 @@ let set_arithmetic () : unit result =
expect_eq program "mem_op"
(e_set [e_string "foo" ; e_string "bar"])
(e_bool false) in
let%bind () =
expect_eq program "iter_op"
(e_set [e_int 2 ; e_int 4 ; e_int 7])
(e_int 13) in
ok ()
let unit_expression () : unit result =