ligo/src/test/contracts/match.mligo
John David Pressman 71989876db Fix a bug, test added:
A never accounted message was not adding anything to the map
2020-01-08 20:58:26 +00:00

29 lines
469 B
Plaintext

type storage = int
type param =
Add of int
| Sub of int
let main (p, s: param * storage) =
let storage =
s +
(match p with
Add n -> n
| Sub n -> 0-n)
in ([] : operation list), storage
let match_bool (b: bool) : int =
match b with
true -> 10
| false -> 0
let match_list (l: int list) : int =
match l with
hd :: tl -> hd
| [] -> 10
let match_option (i: int option) : int =
match i with
Some n -> n
| None -> 0