Update tests for entrypoints

This commit is contained in:
Ulf Norell
2019-06-27 14:16:33 +02:00
parent 85408a12a2
commit 6a59e455ce
51 changed files with 465 additions and 446 deletions
+6 -6
View File
@@ -6,24 +6,24 @@ contract Stack =
record state = { stack : stack(string),
size : int }
function init(ss : list(string)) = { stack = ss, size = length(ss) }
entrypoint init(ss : list(string)) = { stack = ss, size = length(ss) }
private function length(xs) =
function length(xs) =
switch(xs)
[] => 0
_ :: xs => length(xs) + 1
stateful function pop() : string =
stateful entrypoint pop() : string =
switch(state.stack)
s :: ss =>
put(state{ stack = ss, size = state.size - 1 })
s
stateful function push(s) =
stateful entrypoint push(s) =
put(state{ stack = s :: state.stack, size = state.size + 1 })
state.size
function all() = state.stack
entrypoint all() = state.stack
function size() = state.size
entrypoint size() = state.size