From b50e4ab63aa35d8fd8b6c683460b312173ace0a2 Mon Sep 17 00:00:00 2001 From: KtorZ Date: Sat, 20 Jan 2024 10:43:17 +0100 Subject: [PATCH] Re-format and re-run all acceptance tests. --- examples/acceptance_tests/001/lib/tests.ak | 6 +- examples/acceptance_tests/003/lib/tests.ak | 6 +- examples/acceptance_tests/004/lib/tests.ak | 6 +- examples/acceptance_tests/006/lib/tests.ak | 1 - examples/acceptance_tests/007/lib/tests.ak | 3 +- examples/acceptance_tests/010/lib/tests.ak | 6 +- examples/acceptance_tests/013/lib/tests.ak | 6 +- examples/acceptance_tests/016/lib/tests.ak | 3 +- examples/acceptance_tests/018/lib/tests.ak | 6 +- examples/acceptance_tests/019/lib/tests.ak | 6 +- examples/acceptance_tests/020/lib/tests.ak | 6 +- examples/acceptance_tests/022/lib/tests.ak | 9 +- examples/acceptance_tests/024/lib/tests.ak | 9 +- examples/acceptance_tests/026/lib/tests.ak | 9 +- examples/acceptance_tests/029/lib/tests.ak | 9 +- examples/acceptance_tests/033/lib/tests.ak | 3 +- examples/acceptance_tests/034/lib/tests.ak | 6 +- .../acceptance_tests/035/lib/aiken/dict.ak | 6 +- examples/acceptance_tests/035/lib/tests.ak | 15 +- examples/acceptance_tests/036/aiken.lock | 2 +- examples/acceptance_tests/036/plutus.json | 2 +- .../acceptance_tests/036/validators/spend.ak | 9 +- examples/acceptance_tests/038/lib/tests.ak | 12 +- examples/acceptance_tests/044/lib/tests.ak | 18 +- examples/acceptance_tests/045/lib/tests.ak | 3 +- examples/acceptance_tests/046/lib/tests.ak | 12 +- examples/acceptance_tests/047/plutus.json | 2 +- examples/acceptance_tests/048/lib/tests.ak | 54 +- examples/acceptance_tests/049/lib/tests.ak | 3 +- examples/acceptance_tests/050/lib/tests.ak | 27 +- examples/acceptance_tests/052/lib/tests.ak | 12 +- examples/acceptance_tests/053/lib/tests.ak | 9 +- examples/acceptance_tests/054/aiken.lock | 2 +- examples/acceptance_tests/054/lib/tests.ak | 3 +- examples/acceptance_tests/055/aiken.lock | 2 +- examples/acceptance_tests/055/lib/tests.ak | 47 +- examples/acceptance_tests/056/lib/choice_a.ak | 9 +- examples/acceptance_tests/056/lib/choice_b.ak | 9 +- examples/acceptance_tests/056/lib/choice_c.ak | 9 +- examples/acceptance_tests/057/lib/tests.ak | 12 +- examples/acceptance_tests/058/lib/tests.ak | 12 +- examples/acceptance_tests/059/lib/tests.ak | 12 +- examples/acceptance_tests/060/lib/tests.ak | 9 +- examples/acceptance_tests/061/aiken.lock | 2 +- examples/acceptance_tests/061/lib/tests.ak | 9 +- examples/acceptance_tests/063/aiken.lock | 2 +- examples/acceptance_tests/063/lib/tests.ak | 3 +- examples/acceptance_tests/067/aiken.lock | 2 +- examples/acceptance_tests/067/lib/tests.ak | 540 ++++++------------ examples/acceptance_tests/068/aiken.lock | 2 +- examples/acceptance_tests/068/lib/tests.ak | 6 +- examples/acceptance_tests/069/aiken.lock | 2 +- examples/acceptance_tests/071/aiken.lock | 2 +- examples/acceptance_tests/071/plutus.json | 2 +- .../acceptance_tests/071/validators/spend.ak | 27 +- examples/acceptance_tests/072/aiken.lock | 2 +- examples/acceptance_tests/072/lib/tests.ak | 30 +- examples/acceptance_tests/074/aiken.lock | 2 +- examples/acceptance_tests/074/lib/tests.ak | 99 ++-- examples/acceptance_tests/076/lib/tests.ak | 2 +- examples/acceptance_tests/077/aiken.lock | 2 +- examples/acceptance_tests/077/plutus.json | 2 +- .../acceptance_tests/077/validators/spend.ak | 31 +- examples/acceptance_tests/078/lib/tests.ak | 12 +- examples/acceptance_tests/079/plutus.json | 2 +- examples/acceptance_tests/082/aiken.lock | 2 +- examples/acceptance_tests/082/lib/tests.ak | 62 +- examples/acceptance_tests/083/aiken.lock | 2 +- examples/acceptance_tests/083/lib/tests.ak | 2 +- examples/acceptance_tests/084/aiken.lock | 2 +- examples/acceptance_tests/085/aiken.lock | 2 +- examples/acceptance_tests/086/aiken.lock | 2 +- examples/acceptance_tests/086/plutus.json | 2 +- examples/acceptance_tests/087/aiken.lock | 2 +- examples/acceptance_tests/088/aiken.lock | 2 +- examples/acceptance_tests/089/aiken.lock | 2 +- examples/acceptance_tests/090/plutus.json | 2 +- 77 files changed, 449 insertions(+), 830 deletions(-) diff --git a/examples/acceptance_tests/001/lib/tests.ak b/examples/acceptance_tests/001/lib/tests.ak index 8a609f5c..75355cc8 100644 --- a/examples/acceptance_tests/001/lib/tests.ak +++ b/examples/acceptance_tests/001/lib/tests.ak @@ -1,9 +1,7 @@ pub fn length(xs: List) -> Int { when xs is { - [] -> - 0 - [_, ..rest] -> - 1 + length(rest) + [] -> 0 + [_, ..rest] -> 1 + length(rest) } } diff --git a/examples/acceptance_tests/003/lib/tests.ak b/examples/acceptance_tests/003/lib/tests.ak index 99e7c436..49b48533 100644 --- a/examples/acceptance_tests/003/lib/tests.ak +++ b/examples/acceptance_tests/003/lib/tests.ak @@ -1,9 +1,7 @@ pub fn foldr(xs: List, f: fn(a, b) -> b, zero: b) -> b { when xs is { - [] -> - zero - [x, ..rest] -> - f(x, foldr(rest, f, zero)) + [] -> zero + [x, ..rest] -> f(x, foldr(rest, f, zero)) } } diff --git a/examples/acceptance_tests/004/lib/tests.ak b/examples/acceptance_tests/004/lib/tests.ak index c7478e73..169f2b3d 100644 --- a/examples/acceptance_tests/004/lib/tests.ak +++ b/examples/acceptance_tests/004/lib/tests.ak @@ -1,9 +1,7 @@ pub fn foldr(xs: List, f: fn(a, b) -> b, zero: b) -> b { when xs is { - [] -> - zero - [x, ..rest] -> - f(x, foldr(rest, f, zero)) + [] -> zero + [x, ..rest] -> f(x, foldr(rest, f, zero)) } } diff --git a/examples/acceptance_tests/006/lib/tests.ak b/examples/acceptance_tests/006/lib/tests.ak index 1241a51b..02217809 100644 --- a/examples/acceptance_tests/006/lib/tests.ak +++ b/examples/acceptance_tests/006/lib/tests.ak @@ -10,4 +10,3 @@ test bar() { False } } - diff --git a/examples/acceptance_tests/007/lib/tests.ak b/examples/acceptance_tests/007/lib/tests.ak index 49cad116..29a47b70 100644 --- a/examples/acceptance_tests/007/lib/tests.ak +++ b/examples/acceptance_tests/007/lib/tests.ak @@ -9,7 +9,8 @@ pub fn unzip(xs: List<(a, b)>) -> (List, List) { } test unzip1() { - let x = [(3, #"55"), (4, #"7799")] + let x = + [(3, #"55"), (4, #"7799")] unzip(x) == ([3, 4], [#"55", #"7799"]) } diff --git a/examples/acceptance_tests/010/lib/tests.ak b/examples/acceptance_tests/010/lib/tests.ak index b4646306..31260b9b 100644 --- a/examples/acceptance_tests/010/lib/tests.ak +++ b/examples/acceptance_tests/010/lib/tests.ak @@ -1,9 +1,7 @@ pub fn map(opt: Option, f: fn(a) -> b) -> Option { when opt is { - None -> - None - Some(a) -> - Some(f(a)) + None -> None + Some(a) -> Some(f(a)) } } diff --git a/examples/acceptance_tests/013/lib/tests.ak b/examples/acceptance_tests/013/lib/tests.ak index df9a87a3..311de32f 100644 --- a/examples/acceptance_tests/013/lib/tests.ak +++ b/examples/acceptance_tests/013/lib/tests.ak @@ -1,10 +1,8 @@ pub fn unzip(xs: List<(a, b)>) -> (List, List) { when xs is { - [] -> - ([], []) + [] -> ([], []) [(a, b), ..rest] -> { - let (a_tail, b_tail) = - unzip(rest) + let (a_tail, b_tail) = unzip(rest) ([a, ..a_tail], [b, ..b_tail]) } } diff --git a/examples/acceptance_tests/016/lib/tests.ak b/examples/acceptance_tests/016/lib/tests.ak index 53230255..72462cea 100644 --- a/examples/acceptance_tests/016/lib/tests.ak +++ b/examples/acceptance_tests/016/lib/tests.ak @@ -13,7 +13,6 @@ pub fn drop(bytes: ByteArray, n: Int) -> ByteArray { } test drop_1() { - let x = - #"01020304050607" + let x = #"01020304050607" drop(x, 2) == #"0304050607" } diff --git a/examples/acceptance_tests/018/lib/tests.ak b/examples/acceptance_tests/018/lib/tests.ak index ccadaf0e..335b0770 100644 --- a/examples/acceptance_tests/018/lib/tests.ak +++ b/examples/acceptance_tests/018/lib/tests.ak @@ -1,9 +1,7 @@ pub fn or_else(opt: Option, default: a) -> a { when opt is { - None -> - default - Some(a) -> - a + None -> default + Some(a) -> a } } diff --git a/examples/acceptance_tests/019/lib/tests.ak b/examples/acceptance_tests/019/lib/tests.ak index c6cb4dac..7b536da4 100644 --- a/examples/acceptance_tests/019/lib/tests.ak +++ b/examples/acceptance_tests/019/lib/tests.ak @@ -1,9 +1,7 @@ pub fn map(opt: Option, f: fn(a) -> result) -> Option { when opt is { - None -> - None - Some(a) -> - Some(f(a)) + None -> None + Some(a) -> Some(f(a)) } } diff --git a/examples/acceptance_tests/020/lib/tests.ak b/examples/acceptance_tests/020/lib/tests.ak index 70b12579..a199733d 100644 --- a/examples/acceptance_tests/020/lib/tests.ak +++ b/examples/acceptance_tests/020/lib/tests.ak @@ -1,9 +1,7 @@ pub fn map(opt: Option, f: fn(a) -> result) -> Option { when opt is { - None -> - None - Some(a) -> - Some(f(a)) + None -> None + Some(a) -> Some(f(a)) } } diff --git a/examples/acceptance_tests/022/lib/tests.ak b/examples/acceptance_tests/022/lib/tests.ak index d3514aa5..87cf5f7c 100644 --- a/examples/acceptance_tests/022/lib/tests.ak +++ b/examples/acceptance_tests/022/lib/tests.ak @@ -1,9 +1,7 @@ pub fn foldr(xs: List, f: fn(a, b) -> b, zero: b) -> b { when xs is { - [] -> - zero - [x, ..rest] -> - f(x, foldr(rest, f, zero)) + [] -> zero + [x, ..rest] -> f(x, foldr(rest, f, zero)) } } @@ -12,8 +10,7 @@ pub fn filter_map(xs: List, f: fn(a) -> Option) -> List { xs, fn(x, ys) { when f(x) is { - None -> - ys + None -> ys Some(y) -> [y, ..ys] } diff --git a/examples/acceptance_tests/024/lib/tests.ak b/examples/acceptance_tests/024/lib/tests.ak index 3f036032..497ed5cc 100644 --- a/examples/acceptance_tests/024/lib/tests.ak +++ b/examples/acceptance_tests/024/lib/tests.ak @@ -4,14 +4,11 @@ pub fn map2( f: fn(a, b) -> result, ) -> Option { when opt_a is { - None -> - None + None -> None Some(a) -> when opt_b is { - None -> - None - Some(b) -> - Some(f(a, b)) + None -> None + Some(b) -> Some(f(a, b)) } } } diff --git a/examples/acceptance_tests/026/lib/tests.ak b/examples/acceptance_tests/026/lib/tests.ak index 1d8a27ef..7669a51c 100644 --- a/examples/acceptance_tests/026/lib/tests.ak +++ b/examples/acceptance_tests/026/lib/tests.ak @@ -1,9 +1,7 @@ pub fn foldr(xs: List, f: fn(a, b) -> b, zero: b) -> b { when xs is { - [] -> - zero - [x, ..rest] -> - f(x, foldr(rest, f, zero)) + [] -> zero + [x, ..rest] -> f(x, foldr(rest, f, zero)) } } @@ -15,8 +13,7 @@ pub fn flat_map(xs: List, f: fn(a) -> List) -> List { when xs is { [] -> [] - [x, ..rest] -> - concat(f(x), flat_map(rest, f)) + [x, ..rest] -> concat(f(x), flat_map(rest, f)) } } diff --git a/examples/acceptance_tests/029/lib/tests.ak b/examples/acceptance_tests/029/lib/tests.ak index 733be4cf..4751ca22 100644 --- a/examples/acceptance_tests/029/lib/tests.ak +++ b/examples/acceptance_tests/029/lib/tests.ak @@ -14,8 +14,7 @@ fn do_from_list(xs: List<(key, value)>) -> List<(key, value)> { when xs is { [] -> [] - [(k, v), ..rest] -> - do_insert(do_from_list(rest), k, v) + [(k, v), ..rest] -> do_insert(do_from_list(rest), k, v) } } @@ -52,10 +51,8 @@ fn do_union( right: List<(key, value)>, ) -> List<(key, value)> { when left is { - [] -> - right - [(k, v), ..rest] -> - do_union(rest, do_insert(right, k, v)) + [] -> right + [(k, v), ..rest] -> do_union(rest, do_insert(right, k, v)) } } diff --git a/examples/acceptance_tests/033/lib/tests.ak b/examples/acceptance_tests/033/lib/tests.ak index b16f014f..cca7041d 100644 --- a/examples/acceptance_tests/033/lib/tests.ak +++ b/examples/acceptance_tests/033/lib/tests.ak @@ -1,5 +1,4 @@ test tuple_1() { - let coordinates = - (14, 42) + let coordinates = (14, 42) coordinates.1st == 14 && coordinates.2nd == 42 } diff --git a/examples/acceptance_tests/034/lib/tests.ak b/examples/acceptance_tests/034/lib/tests.ak index 2a3b0674..110d7f90 100644 --- a/examples/acceptance_tests/034/lib/tests.ak +++ b/examples/acceptance_tests/034/lib/tests.ak @@ -1,9 +1,7 @@ pub fn foldr(self: List, with: fn(a, b) -> b, zero: b) -> b { when self is { - [] -> - zero - [x, ..xs] -> - with(x, foldr(xs, with, zero)) + [] -> zero + [x, ..xs] -> with(x, foldr(xs, with, zero)) } } diff --git a/examples/acceptance_tests/035/lib/aiken/dict.ak b/examples/acceptance_tests/035/lib/aiken/dict.ak index a333c240..29772053 100644 --- a/examples/acceptance_tests/035/lib/aiken/dict.ak +++ b/examples/acceptance_tests/035/lib/aiken/dict.ak @@ -37,8 +37,7 @@ fn do_union_with( with: fn(ByteArray, value, value) -> Option, ) -> List<(ByteArray, value)> { when left is { - [] -> - right + [] -> right [(k, v), ..rest] -> do_union_with(rest, do_insert_with(right, k, v, with), with) } @@ -58,8 +57,7 @@ fn do_insert_with( when with(k, v, v2) is { Some(combined) -> [(k, combined), ..rest] - None -> - rest + None -> rest } } else { [(k2, v2), ..do_insert_with(rest, k, v, with)] diff --git a/examples/acceptance_tests/035/lib/tests.ak b/examples/acceptance_tests/035/lib/tests.ak index f9865e78..18ecaced 100644 --- a/examples/acceptance_tests/035/lib/tests.ak +++ b/examples/acceptance_tests/035/lib/tests.ak @@ -35,8 +35,7 @@ pub fn add(left v0: Value, right v1: Value) -> Value { a0, a1, fn(_, q0, q1) { - let q = - q0 + q1 + let q = q0 + q1 if q == 0 { None } else { @@ -46,19 +45,15 @@ pub fn add(left v0: Value, right v1: Value) -> Value { ) when dict.toList(asset) is { - [] -> - None - _ -> - Some(asset) + [] -> None + _ -> Some(asset) } }, ) } test add_1() { - let v1 = - from_lovelace(1) - let v2 = - from_lovelace(-1) + let v1 = from_lovelace(1) + let v2 = from_lovelace(-1) add(v1, v2) == dict.new() } diff --git a/examples/acceptance_tests/036/aiken.lock b/examples/acceptance_tests/036/aiken.lock index 956b09e8..90c74e36 100644 --- a/examples/acceptance_tests/036/aiken.lock +++ b/examples/acceptance_tests/036/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181051, nanos_since_epoch = 270212000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743641, nanos_since_epoch = 8357000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/036/plutus.json b/examples/acceptance_tests/036/plutus.json index 5607dfbd..9661a37c 100644 --- a/examples/acceptance_tests/036/plutus.json +++ b/examples/acceptance_tests/036/plutus.json @@ -5,7 +5,7 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.21-alpha+0161cf6" + "version": "v1.0.21-alpha+bf96c3a" } }, "validators": [ diff --git a/examples/acceptance_tests/036/validators/spend.ak b/examples/acceptance_tests/036/validators/spend.ak index 3613b3e0..a75c1c17 100644 --- a/examples/acceptance_tests/036/validators/spend.ak +++ b/examples/acceptance_tests/036/validators/spend.ak @@ -3,8 +3,7 @@ use aiken/list use aiken/transaction.{Output, OutputReference, ScriptContext} use aiken/transaction/value.{PolicyId} -const my_policy_id: PolicyId = - #"0000000000" +const my_policy_id: PolicyId = #"0000000000" pub fn has_policy_id(self: Output, policy_id: PolicyId) -> Bool { self.value @@ -28,10 +27,8 @@ validator(output_reference: OutputReference) { fn(input) { input.output_reference == output_reference }, ) is { - Some(_) -> - True - None -> - False + Some(_) -> True + None -> False } } } diff --git a/examples/acceptance_tests/038/lib/tests.ak b/examples/acceptance_tests/038/lib/tests.ak index 6bcaab45..c6fc7067 100644 --- a/examples/acceptance_tests/038/lib/tests.ak +++ b/examples/acceptance_tests/038/lib/tests.ak @@ -1,9 +1,7 @@ pub fn and_f(self: List) -> Bool { when self is { - [] -> - True - [x, ..xs] -> - x && and_f(xs) + [] -> True + [x, ..xs] -> x && and_f(xs) } } @@ -13,10 +11,8 @@ test and_f_1() { pub fn or_f(self: List) -> Bool { when self is { - [] -> - False - [x, ..xs] -> - x || or_f(xs) + [] -> False + [x, ..xs] -> x || or_f(xs) } } diff --git a/examples/acceptance_tests/044/lib/tests.ak b/examples/acceptance_tests/044/lib/tests.ak index dcf8a056..0fc18747 100644 --- a/examples/acceptance_tests/044/lib/tests.ak +++ b/examples/acceptance_tests/044/lib/tests.ak @@ -1,23 +1,17 @@ test foo_1() { - let a = - False + let a = False when a is { - True -> - False - False -> - True + True -> False + False -> True } } test foo_2() { - let a = - False + let a = False let b = when a is { - True -> - 14 - False -> - 42 + True -> 14 + False -> 42 } b == 42 } diff --git a/examples/acceptance_tests/045/lib/tests.ak b/examples/acceptance_tests/045/lib/tests.ak index f06e701e..dff735e9 100644 --- a/examples/acceptance_tests/045/lib/tests.ak +++ b/examples/acceptance_tests/045/lib/tests.ak @@ -11,7 +11,6 @@ fn fibonnaci(n) { test foo() { let right = fn() { fibonnaci(15) == 610 } - let left = - False + let left = False left || right() } diff --git a/examples/acceptance_tests/046/lib/tests.ak b/examples/acceptance_tests/046/lib/tests.ak index 2f200144..4b43c42c 100644 --- a/examples/acceptance_tests/046/lib/tests.ak +++ b/examples/acceptance_tests/046/lib/tests.ak @@ -2,13 +2,9 @@ test sort_by_1() { let xs = [[4, 3, 2, 1], [2, 3, 4, 5]] when xs is { - [[], ys] -> - False - [xs, []] -> - False - [[x, ..xs2], [y, ..ys2]] -> - True - _ -> - False + [[], ys] -> False + [xs, []] -> False + [[x, ..xs2], [y, ..ys2]] -> True + _ -> False } } diff --git a/examples/acceptance_tests/047/plutus.json b/examples/acceptance_tests/047/plutus.json index 5727174d..3e25c40b 100644 --- a/examples/acceptance_tests/047/plutus.json +++ b/examples/acceptance_tests/047/plutus.json @@ -5,7 +5,7 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.21-alpha+0161cf6" + "version": "v1.0.21-alpha+bf96c3a" } }, "validators": [ diff --git a/examples/acceptance_tests/048/lib/tests.ak b/examples/acceptance_tests/048/lib/tests.ak index a0ce78e5..680d5e29 100644 --- a/examples/acceptance_tests/048/lib/tests.ak +++ b/examples/acceptance_tests/048/lib/tests.ak @@ -1,48 +1,34 @@ test foo_1() { - let a = - False + let a = False when a is { - a if a -> - False - _ -> - True + a if a -> False + _ -> True } } test foo_2() { - let point = - (14, 42) + let point = (14, 42) when point is { - (x, _) if x > 100 -> - False - (x, _) if x > 10 -> - True - _ -> - False + (x, _) if x > 100 -> False + (x, _) if x > 10 -> True + _ -> False } } test foo_3() { - let point = - (14, 42) + let point = (14, 42) when point is { - (x, y) if x == 14 && y <= 100 -> - True - _ -> - False + (x, y) if x == 14 && y <= 100 -> True + _ -> False } } test foo_4() { - let a = - False - let point = - (14, 42) + let a = False + let point = (14, 42) when point is { - (x, y) if !a -> - x + y == 56 - _ -> - False + (x, y) if !a -> x + y == 56 + _ -> False } } @@ -55,12 +41,9 @@ type Seasons { fn is_cold(season, hour) { when season is { - Winter | Fall -> - True - _ if hour >= 18 -> - True - _ -> - False + Winter | Fall -> True + _ if hour >= 18 -> True + _ -> False } } @@ -70,8 +53,7 @@ test foo_5() { fn when_tuple(a: (Int, Int)) -> Int { when a is { - (a, _b) -> - a + (a, _b) -> a } } diff --git a/examples/acceptance_tests/049/lib/tests.ak b/examples/acceptance_tests/049/lib/tests.ak index 98b5e7f1..7cef193d 100644 --- a/examples/acceptance_tests/049/lib/tests.ak +++ b/examples/acceptance_tests/049/lib/tests.ak @@ -1,7 +1,6 @@ pub fn when_tuple(a: (Int, Int)) -> Int { when a is { - (a, b) -> - a + (a, b) -> a } } diff --git a/examples/acceptance_tests/050/lib/tests.ak b/examples/acceptance_tests/050/lib/tests.ak index 6873715f..dca9b864 100644 --- a/examples/acceptance_tests/050/lib/tests.ak +++ b/examples/acceptance_tests/050/lib/tests.ak @@ -5,55 +5,46 @@ pub type Thing { } test let_1() { - let x: Data = - 1 + let x: Data = 1 x == builtin.i_data(1) } test let_2() { - let x: Data = - 1 + let x: Data = 1 - expect y: Int = - x + expect y: Int = x y == 1 } test assert_1() { - expect thing: Thing = - builtin.constr_data(0, [builtin.i_data(1)]) + expect thing: Thing = builtin.constr_data(0, [builtin.i_data(1)]) thing.wow == 1 } fn cast_to_thing(x: Data) -> Thing { - expect x: Thing = - x + expect x: Thing = x x } test assert_2() { - let thing = - Thing { wow: 1 } + let thing = Thing { wow: 1 } - let still_thing = - cast_to_thing(thing) + let still_thing = cast_to_thing(thing) still_thing.wow == 1 } test tuple_1() { - let thing = - (#"aa", #"bb", #"cc") + let thing = (#"aa", #"bb", #"cc") thing.1st == #"aa" } test pair_1() { - let thing = - (#"aa", #"bb") + let thing = (#"aa", #"bb") thing.1st == #"aa" } // should not typecheck diff --git a/examples/acceptance_tests/052/lib/tests.ak b/examples/acceptance_tests/052/lib/tests.ak index c09e4fc7..a7de4aa8 100644 --- a/examples/acceptance_tests/052/lib/tests.ak +++ b/examples/acceptance_tests/052/lib/tests.ak @@ -3,20 +3,16 @@ type TransactionId { } test pattern_match_let() { - let x = - TransactionId { inner: #"0000" } - let TransactionId(y) = - x + let x = TransactionId { inner: #"0000" } + let TransactionId(y) = x y == #"0000" } test pattern_match_when() { - let x = - TransactionId { inner: #"0000" } + let x = TransactionId { inner: #"0000" } let y = when x is { - TransactionId(y) -> - y + TransactionId(y) -> y } y == #"0000" } diff --git a/examples/acceptance_tests/053/lib/tests.ak b/examples/acceptance_tests/053/lib/tests.ak index bb36f030..e4f25625 100644 --- a/examples/acceptance_tests/053/lib/tests.ak +++ b/examples/acceptance_tests/053/lib/tests.ak @@ -5,15 +5,12 @@ pub type LinkedList { pub fn size(t: LinkedList) -> Int { when t is { - Empty -> - 0 - Node(_, tail) -> - 1 + size(tail) + Empty -> 0 + Node(_, tail) -> 1 + size(tail) } } test foo() { - let xs = - Node(0, Node(1, Node(2, Empty))) + let xs = Node(0, Node(1, Node(2, Empty))) size(xs) == 3 } diff --git a/examples/acceptance_tests/054/aiken.lock b/examples/acceptance_tests/054/aiken.lock index b9cfdf6f..3c44e5ab 100644 --- a/examples/acceptance_tests/054/aiken.lock +++ b/examples/acceptance_tests/054/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181048, nanos_since_epoch = 152219000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743640, nanos_since_epoch = 944875000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/054/lib/tests.ak b/examples/acceptance_tests/054/lib/tests.ak index cb196467..59ae8fe7 100644 --- a/examples/acceptance_tests/054/lib/tests.ak +++ b/examples/acceptance_tests/054/lib/tests.ak @@ -1,7 +1,6 @@ use aiken/transaction/value test test_quantity_of_1() { - let x = - value.from_asset(#"000000", #"000020e05363726970744f776e6572", -1) + let x = value.from_asset(#"000000", #"000020e05363726970744f776e6572", -1) value.quantity_of(x, #"000000", #"000020e05363726970744f776e6572") < 0 } diff --git a/examples/acceptance_tests/055/aiken.lock b/examples/acceptance_tests/055/aiken.lock index 3f0c2cab..281ab120 100644 --- a/examples/acceptance_tests/055/aiken.lock +++ b/examples/acceptance_tests/055/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181051, nanos_since_epoch = 995566000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743642, nanos_since_epoch = 21373000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/055/lib/tests.ak b/examples/acceptance_tests/055/lib/tests.ak index 1a4f5d85..8b906a5e 100644 --- a/examples/acceptance_tests/055/lib/tests.ak +++ b/examples/acceptance_tests/055/lib/tests.ak @@ -1,7 +1,7 @@ use aiken/bytearray use aiken/dict use aiken/hash.{Hash, Sha2_256, sha2_256} -use aiken/interval.{between, intersection, is_empty, entirely_between} +use aiken/interval.{between, entirely_between, intersection, is_empty} use aiken/list use aiken/transaction.{InlineDatum} @@ -15,12 +15,9 @@ pub type MerkleTree { pub fn root_hash(t: MerkleTree) -> Hash { when t is { - Empty -> - #"" - Leaf { hash, .. } -> - hash - Node { hash, .. } -> - hash + Empty -> #"" + Leaf { hash, .. } -> hash + Node { hash, .. } -> hash } } @@ -30,12 +27,9 @@ pub fn is_equal(a: MerkleTree, b: MerkleTree) -> Bool { pub fn size(t: MerkleTree) -> Int { when t is { - Empty -> - 0 - Leaf { .. } -> - 1 - Node { left, right, .. } -> - size(left) + size(right) + Empty -> 0 + Leaf { .. } -> 1 + Node { left, right, .. } -> size(left) + size(right) } } @@ -49,13 +43,10 @@ pub fn from_list(items0: List) -> MerkleTree { fn do_from_list(items: List, len: Int) -> MerkleTree { when items is { - [] -> - Empty - [value] -> - Leaf { hash: sha2_256(value), value } + [] -> Empty + [value] -> Leaf { hash: sha2_256(value), value } all -> { - let cutoff: Int = - len / 2 + let cutoff: Int = len / 2 let left = all |> list.take(cutoff) @@ -64,8 +55,7 @@ fn do_from_list(items: List, len: Int) -> MerkleTree { all |> list.drop(cutoff) |> do_from_list(len - cutoff) - let hash = - combine_hash(root_hash(left), root_hash(right)) + let hash = combine_hash(root_hash(left), root_hash(right)) Node { hash, left, right } } } @@ -74,8 +64,7 @@ fn do_from_list(items: List, len: Int) -> MerkleTree { test foo() { let items = [#"aa", #"bb", #"cc"] - let mt = - from_list(items) + let mt = from_list(items) size(mt) == 3 } @@ -84,19 +73,15 @@ test some_test1() { } test intersection_3() { - let iv1 = - between(0, 1) - let iv2 = - entirely_between(1, 2) + let iv1 = between(0, 1) + let iv2 = entirely_between(1, 2) intersection(iv1, iv2) |> is_empty } -const fooz = - #"666f6f" +const fooz = #"666f6f" -const bar = - #"626172" +const bar = #"626172" fn fixture_1() { dict.new() diff --git a/examples/acceptance_tests/056/lib/choice_a.ak b/examples/acceptance_tests/056/lib/choice_a.ak index af67b514..91a0fb0d 100644 --- a/examples/acceptance_tests/056/lib/choice_a.ak +++ b/examples/acceptance_tests/056/lib/choice_a.ak @@ -1,12 +1,9 @@ // Could possibly be forbidden by the parser instead if we have no intent to support that. pub fn choice(self: List>) -> Option { when self is { - [] -> - None - [Some(_) as result, ..] -> - result - [None, ..others] -> - choice(others) + [] -> None + [Some(_) as result, ..] -> result + [None, ..others] -> choice(others) } } diff --git a/examples/acceptance_tests/056/lib/choice_b.ak b/examples/acceptance_tests/056/lib/choice_b.ak index 9055b62b..493a31b8 100644 --- a/examples/acceptance_tests/056/lib/choice_b.ak +++ b/examples/acceptance_tests/056/lib/choice_b.ak @@ -1,11 +1,8 @@ pub fn choice(self: List>) -> Option { when self is { - [] -> - None - [Some(x), ..] -> - Some(x) - [None, ..others] -> - choice(others) + [] -> None + [Some(x), ..] -> Some(x) + [None, ..others] -> choice(others) } } diff --git a/examples/acceptance_tests/056/lib/choice_c.ak b/examples/acceptance_tests/056/lib/choice_c.ak index ab211d61..8f38ef31 100644 --- a/examples/acceptance_tests/056/lib/choice_c.ak +++ b/examples/acceptance_tests/056/lib/choice_c.ak @@ -1,11 +1,8 @@ pub fn choice(self: List>) -> Option { when self is { - [] -> - None - [None, ..others] -> - choice(others) - [result, ..] -> - result + [] -> None + [None, ..others] -> choice(others) + [result, ..] -> result } } diff --git a/examples/acceptance_tests/057/lib/tests.ak b/examples/acceptance_tests/057/lib/tests.ak index 92c1f6d6..8340046f 100644 --- a/examples/acceptance_tests/057/lib/tests.ak +++ b/examples/acceptance_tests/057/lib/tests.ak @@ -1,13 +1,9 @@ pub fn alt(left: Option, right: Option) -> Option { when (left, right) is { - (Some(a), Some(_)) -> - Some(a) - (None, Some(a)) -> - Some(a) - (Some(a), None) -> - Some(a) - (None, None) -> - None + (Some(a), Some(_)) -> Some(a) + (None, Some(a)) -> Some(a) + (Some(a), None) -> Some(a) + (None, None) -> None } } diff --git a/examples/acceptance_tests/058/lib/tests.ak b/examples/acceptance_tests/058/lib/tests.ak index 5d4324f4..106d0f24 100644 --- a/examples/acceptance_tests/058/lib/tests.ak +++ b/examples/acceptance_tests/058/lib/tests.ak @@ -6,10 +6,8 @@ test foo() { let xs = [1, 2, 3] when xs is { - [x] -> - x == 1 - _ -> - whatever(xs) + [x] -> x == 1 + _ -> whatever(xs) } } @@ -17,9 +15,7 @@ test bar() { let xs = [1, 2, 3] when xs is { - [x] -> - x == 1 - ys -> - whatever(ys) + [x] -> x == 1 + ys -> whatever(ys) } } diff --git a/examples/acceptance_tests/059/lib/tests.ak b/examples/acceptance_tests/059/lib/tests.ak index 864514c8..e6fa1fdc 100644 --- a/examples/acceptance_tests/059/lib/tests.ak +++ b/examples/acceptance_tests/059/lib/tests.ak @@ -2,10 +2,8 @@ test foo() { let xs = [[1, 2], [4, 5]] when xs is { - [[_, _], [_, _]] -> - True - _ -> - False + [[_, _], [_, _]] -> True + _ -> False } } @@ -14,10 +12,8 @@ test sort_by_1() { [[4, 3], [2, 3]] let g = when xs is { - [[x, xs2], [y, ys2]] -> - True - _ -> - False + [[x, xs2], [y, ys2]] -> True + _ -> False } g == True diff --git a/examples/acceptance_tests/060/lib/tests.ak b/examples/acceptance_tests/060/lib/tests.ak index 5d16a8b0..1a7c8776 100644 --- a/examples/acceptance_tests/060/lib/tests.ak +++ b/examples/acceptance_tests/060/lib/tests.ak @@ -1,19 +1,16 @@ -const int_constant = - 42 +const int_constant = 42 test int() { int_constant == 42 } -const bytearray_constant = - #"abcd" +const bytearray_constant = #"abcd" test bytearray() { bytearray_constant == #"abcd" } -const string_constant = - "FOO" +const string_constant = "FOO" test string() { string_constant == "FOO" diff --git a/examples/acceptance_tests/061/aiken.lock b/examples/acceptance_tests/061/aiken.lock index 2d742d94..7355c56e 100644 --- a/examples/acceptance_tests/061/aiken.lock +++ b/examples/acceptance_tests/061/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181064, nanos_since_epoch = 69739000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743643, nanos_since_epoch = 126963000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/061/lib/tests.ak b/examples/acceptance_tests/061/lib/tests.ak index 7884a0f1..ee0411cb 100644 --- a/examples/acceptance_tests/061/lib/tests.ak +++ b/examples/acceptance_tests/061/lib/tests.ak @@ -8,11 +8,9 @@ use aiken/transaction/credential.{ } use aiken/transaction/value -const keyhash = - #"010203040506" +const keyhash = #"010203040506" -const scripthash = - #"060504030201" +const scripthash = #"060504030201" pub fn keyhash_address(with_stake_credential: Option) { Address { @@ -34,8 +32,7 @@ type SampleData { } pub fn tx_1() -> Transaction { - let sample_datum = - SampleData { a: 1, b: #"01" } + let sample_datum = SampleData { a: 1, b: #"01" } let tx = Transaction { inputs: [ diff --git a/examples/acceptance_tests/063/aiken.lock b/examples/acceptance_tests/063/aiken.lock index e2597a37..ea804348 100644 --- a/examples/acceptance_tests/063/aiken.lock +++ b/examples/acceptance_tests/063/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181052, nanos_since_epoch = 418642000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743642, nanos_since_epoch = 40391000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/063/lib/tests.ak b/examples/acceptance_tests/063/lib/tests.ak index 5a3e0a79..60afb373 100644 --- a/examples/acceptance_tests/063/lib/tests.ak +++ b/examples/acceptance_tests/063/lib/tests.ak @@ -4,8 +4,7 @@ fn must_be_signed(signatories) { trace @"no signatories" False } - [sig, ..] -> - (sig == "#ffff")? + [sig, ..] -> (sig == "#ffff")? } } diff --git a/examples/acceptance_tests/067/aiken.lock b/examples/acceptance_tests/067/aiken.lock index 95f8bd70..605b7574 100644 --- a/examples/acceptance_tests/067/aiken.lock +++ b/examples/acceptance_tests/067/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181066, nanos_since_epoch = 607926000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743643, nanos_since_epoch = 283477000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/067/lib/tests.ak b/examples/acceptance_tests/067/lib/tests.ak index d098dec8..c4a66f5c 100644 --- a/examples/acceptance_tests/067/lib/tests.ak +++ b/examples/acceptance_tests/067/lib/tests.ak @@ -37,25 +37,19 @@ pub fn to_list(self: MerkleTree) -> List { [] Leaf { value, .. } -> [value] - Node { left, right, .. } -> - list.concat(to_list(left), to_list(right)) + Node { left, right, .. } -> list.concat(to_list(left), to_list(right)) } } test to_list_1() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" let items = [dog, cat, mouse] - let hash_fn = - create_string_item_hash_fn() + let hash_fn = create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let mt = from_list(items, hash_fn) items == to_list(mt) } @@ -63,54 +57,39 @@ test to_list_1() { // Function returning a hash of a given Merkle Tree element pub fn root_hash(self: MerkleTree) -> Hash { when self is { - Empty -> - "" - Leaf { hash, .. } -> - hash - Node { hash, .. } -> - hash + Empty -> "" + Leaf { hash, .. } -> hash + Node { hash, .. } -> hash } } test root_hash_1() { - let dog = - "dog" + let dog = "dog" let items = [dog] - let hash_fn = - create_string_item_hash_fn() + let hash_fn = create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let mt = from_list(items, hash_fn) - let node_hash = - hash_fn(dog) + let node_hash = hash_fn(dog) root_hash(mt) == node_hash } test root_hash_3() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" let items = [dog, cat, mouse] - let hash_fn = - create_string_item_hash_fn() + let hash_fn = create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let mt = from_list(items, hash_fn) - let node_hash = - sha2_256(bytearray.concat(hash_fn(cat), hash_fn(mouse))) - let rh = - sha2_256(bytearray.concat(hash_fn(dog), node_hash)) + let node_hash = sha2_256(bytearray.concat(hash_fn(cat), hash_fn(mouse))) + let rh = sha2_256(bytearray.concat(hash_fn(dog), node_hash)) - expect Node { hash: root_hash, .. } = - mt + expect Node { hash: root_hash, .. } = mt rh == root_hash } @@ -118,13 +97,10 @@ test root_hash_3() { test root_hash_2() { let items = [] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) - let node_hash = - #"" + let node_hash = #"" root_hash(mt) == node_hash } @@ -137,78 +113,55 @@ pub fn is_equal(left: MerkleTree, right: MerkleTree) -> Bool { /// Function returns a total numbers of leaves in the tree. pub fn size(self: MerkleTree) -> Int { when self is { - Empty -> - 0 - Leaf { .. } -> - 1 - Node { left, right, .. } -> - size(left) + size(right) + Empty -> 0 + Leaf { .. } -> 1 + Node { left, right, .. } -> size(left) + size(right) } } test size_1() { let items = [] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) size(mt) == 0 } test size_2() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" - let hash_fn = - create_string_item_hash_fn() + let dog = "dog" + let cat = "cat" + let mouse = "mouse" + let hash_fn = create_string_item_hash_fn() - let mt = - from_list([dog, cat, mouse], hash_fn) + let mt = from_list([dog, cat, mouse], hash_fn) size(mt) == 3 } test size_3() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" let items = [dog, cat, mouse] - let hash_fn = - create_string_item_hash_fn() + let hash_fn = create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let mt = from_list(items, hash_fn) size(mt) == 3 } test size_4() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" - let horse = - "horse" - let pig = - "pig" - let bull = - "bull" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" + let horse = "horse" + let pig = "pig" + let bull = "bull" - let hash_fn = - create_string_item_hash_fn() + let hash_fn = create_string_item_hash_fn() let items = [dog, cat, mouse, horse, pig, bull] - let mt = - from_list(items, hash_fn) + let mt = from_list(items, hash_fn) size(mt) == 6 } @@ -222,28 +175,22 @@ fn combine_hash( /// Function that returns whether merkle tree has any elements pub fn is_empty(self: MerkleTree) -> Bool { when self is { - Empty -> - True - _ -> - False + Empty -> True + _ -> False } } test is_empty_1() { - let mt = - Empty + let mt = Empty is_empty(mt) } test is_empty_2() { - let dog = - "dog" - let hash = - create_string_item_hash_fn() + let dog = "dog" + let hash = create_string_item_hash_fn() - let mt = - Leaf { value: dog, hash: hash(dog) } + let mt = Leaf { value: dog, hash: hash(dog) } is_empty(mt) == False } @@ -255,8 +202,7 @@ fn do_proof( hash_fn: fn(a) -> Hash, ) -> Option { when self is { - Empty -> - None + Empty -> None Leaf { hash, .. } -> if hash == item_hash { Some(proof) @@ -264,10 +210,8 @@ fn do_proof( None } Node { left, right, .. } -> { - let rh = - root_hash(right) - let lh = - root_hash(left) + let rh = root_hash(right) + let lh = root_hash(left) let go_left: Option = do_proof(left, item_hash, list.push(proof, Right { hash: rh }), hash_fn) let go_right: Option = @@ -292,130 +236,91 @@ pub fn get_proof( } test get_proof_1() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" - let horse = - "horse" - let pig = - "pig" - let bull = - "bull" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" + let horse = "horse" + let pig = "pig" + let bull = "bull" let items = [dog, cat, mouse, horse, pig, bull] - let hash_fn = - create_string_item_hash_fn() + let hash_fn = create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) - let hash_fn = - create_string_item_hash_fn() + let mt = from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() - let maybe_proof: Option = - get_proof(mt, "parrot", hash_fn) + let maybe_proof: Option = get_proof(mt, "parrot", hash_fn) is_none(maybe_proof) } test get_proof_2() { - let dog = - "dog" + let dog = "dog" let items = [dog] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) - let maybe_proof: Option = - get_proof(mt, dog, hash_fn) + let maybe_proof: Option = get_proof(mt, dog, hash_fn) - expect Some(proof) = - maybe_proof + expect Some(proof) = maybe_proof // when proof is empty list it actually means that root of the tree is in fact element proof == [] } test get_proof_3() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" let items = [dog, cat, mouse] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) - let node_hash = - sha2_256(bytearray.concat(hash_fn(cat), hash_fn(mouse))) + let node_hash = sha2_256(bytearray.concat(hash_fn(cat), hash_fn(mouse))) - let maybe_proof: Option = - get_proof(mt, dog, hash_fn) + let maybe_proof: Option = get_proof(mt, dog, hash_fn) - expect Some(proof) = - maybe_proof + expect Some(proof) = maybe_proof - let size_match = - list.length(proof) == 1 + let size_match = list.length(proof) == 1 - expect Some(p1) = - list.at(proof, 0) + expect Some(p1) = list.at(proof, 0) - let h1: ByteArray = - get_proof_item_value(p1) + let h1: ByteArray = get_proof_item_value(p1) size_match && h1 == node_hash } test get_proof_4() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" - let horse = - "horse" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" + let horse = "horse" let items = [dog, cat, mouse, horse] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) let right_node_hash = sha2_256(bytearray.concat(hash_fn(mouse), hash_fn(horse))) - let maybe_proof: Option = - get_proof(mt, dog, hash_fn) + let maybe_proof: Option = get_proof(mt, dog, hash_fn) - expect Some(proof) = - maybe_proof + expect Some(proof) = maybe_proof - let size_match = - list.length(proof) == 2 + let size_match = list.length(proof) == 2 - expect Some(p1) = - list.at(proof, 0) - expect Some(p2) = - list.at(proof, 1) + expect Some(p1) = list.at(proof, 0) + expect Some(p2) = list.at(proof, 1) - let h1: ByteArray = - get_proof_item_value(p1) - let h2: ByteArray = - get_proof_item_value(p2) + let h1: ByteArray = get_proof_item_value(p1) + let h2: ByteArray = get_proof_item_value(p2) size_match && h1 == hash_fn(cat) && h2 == right_node_hash } @@ -426,16 +331,13 @@ fn do_from_list( hash_fn: fn(a) -> Hash, ) -> MerkleTree { when items is { - [] -> - Empty + [] -> Empty [item] -> { - let hashed_item = - hash_fn(item) + let hashed_item = hash_fn(item) Leaf { value: item, hash: hashed_item } } all -> { - let cutoff: Int = - len / 2 + let cutoff: Int = len / 2 let left = all |> list.take(cutoff) @@ -444,8 +346,7 @@ fn do_from_list( all |> list.drop(cutoff) |> do_from_list(len - cutoff, hash_fn) - let hash = - combine_hash(root_hash(left), root_hash(right)) + let hash = combine_hash(root_hash(left), root_hash(right)) Node { hash, left, right } } } @@ -462,46 +363,35 @@ pub fn from_list( } test from_1() { - let _a = - -1 + let _a = -1 let items = [] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) Empty == mt } test from_2() { - let dog = - "dog" + let dog = "dog" let items = [dog] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) Leaf { value: dog, hash: hash_fn(dog) } == mt } test from_3() { - let dog = - "dog" - let cat = - "cat" + let dog = "dog" + let cat = "cat" let items = [dog, cat] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) - let root_hash = - sha2_256(bytearray.concat(hash_fn(dog), hash_fn(cat))) + let root_hash = sha2_256(bytearray.concat(hash_fn(dog), hash_fn(cat))) Node { hash: root_hash, @@ -511,25 +401,18 @@ test from_3() { } test from_4() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" let items = [dog, cat, mouse] - let hash_fn = - create_string_item_hash_fn() + let hash_fn = create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let mt = from_list(items, hash_fn) - let node_hash = - sha2_256(bytearray.concat(hash_fn(cat), hash_fn(mouse))) - let root_hash = - sha2_256(bytearray.concat(hash_fn(dog), node_hash)) + let node_hash = sha2_256(bytearray.concat(hash_fn(cat), hash_fn(mouse))) + let root_hash = sha2_256(bytearray.concat(hash_fn(dog), node_hash)) Node { hash: root_hash, @@ -543,30 +426,22 @@ test from_4() { } test from_5() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" - let horse = - "horse" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" + let horse = "horse" - let hash_fn = - create_string_item_hash_fn() + let hash_fn = create_string_item_hash_fn() let items = [dog, cat, mouse, horse] - let mt = - from_list(items, hash_fn) + let mt = from_list(items, hash_fn) - let left_node_hash = - sha2_256(bytearray.concat(hash_fn(dog), hash_fn(cat))) + let left_node_hash = sha2_256(bytearray.concat(hash_fn(dog), hash_fn(cat))) let right_node_hash = sha2_256(bytearray.concat(hash_fn(mouse), hash_fn(horse))) - let root_hash = - sha2_256(bytearray.concat(left_node_hash, right_node_hash)) + let root_hash = sha2_256(bytearray.concat(left_node_hash, right_node_hash)) Node { hash: root_hash, @@ -594,8 +469,7 @@ pub fn member_from_hash( hash_fn: fn(a) -> Hash, ) -> Bool { when proof is { - [] -> - root_hash == item_hash + [] -> root_hash == item_hash [head, ..tail] -> when head is { Left { hash: l } -> @@ -614,173 +488,119 @@ pub fn member( proof: Proof, hash_fn: fn(a) -> Hash, ) -> Bool { - let item_hash = - hash_fn(item) + let item_hash = hash_fn(item) member_from_hash(item_hash, root_hash, proof, hash_fn) } test member_1() { - let dog = - "dog" + let dog = "dog" let items = [dog] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) - let item = - dog - let rh = - root_hash(mt) + let item = dog + let rh = root_hash(mt) - expect Some(proof) = - get_proof(mt, item, hash_fn) + expect Some(proof) = get_proof(mt, item, hash_fn) member(item: item, root_hash: rh, proof: proof, hash_fn: hash_fn) } test member_2() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" - let horse = - "horse" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" + let horse = "horse" let items = [dog, cat, mouse, horse] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) - let item = - cat - let rh = - root_hash(mt) + let item = cat + let rh = root_hash(mt) - expect Some(proof) = - get_proof(mt, item, hash_fn) + expect Some(proof) = get_proof(mt, item, hash_fn) member(item: item, root_hash: rh, proof: proof, hash_fn: hash_fn) } test member_3() { - let dog = - "dog" - let cat = - "cat" + let dog = "dog" + let cat = "cat" let items = [dog, cat] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) - let item = - cat - let rh = - root_hash(mt) + let item = cat + let rh = root_hash(mt) - expect Some(proof) = - get_proof(mt, item, hash_fn) + expect Some(proof) = get_proof(mt, item, hash_fn) member(item: item, root_hash: rh, proof: proof, hash_fn: hash_fn) } test member_4() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" let items = [dog, cat, mouse] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) - let item = - mouse - let rh = - root_hash(mt) + let item = mouse + let rh = root_hash(mt) - expect Some(proof) = - get_proof(mt, item, hash_fn) + expect Some(proof) = get_proof(mt, item, hash_fn) member(item: item, root_hash: rh, proof: proof, hash_fn: hash_fn) } test member_5() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" - let horse = - "horse" - let pig = - "pig" - let bull = - "bull" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" + let horse = "horse" + let pig = "pig" + let bull = "bull" let items = [dog, cat, mouse, horse, pig, bull] - let hash_fn = - create_string_item_hash_fn() - let mt = - from_list(items, hash_fn) + let hash_fn = create_string_item_hash_fn() + let mt = from_list(items, hash_fn) - let item = - pig - let rh = - root_hash(mt) + let item = pig + let rh = root_hash(mt) - expect Some(proof) = - get_proof(mt, item, hash_fn) + expect Some(proof) = get_proof(mt, item, hash_fn) member(item: item, root_hash: rh, proof: proof, hash_fn: hash_fn) } test member_6() { - let dog = - "dog" - let cat = - "cat" - let mouse = - "mouse" - let horse = - "horse" - let pig = - "pig" - let bull = - "bull" + let dog = "dog" + let cat = "cat" + let mouse = "mouse" + let horse = "horse" + let pig = "pig" + let bull = "bull" - let hash_fn = - create_string_item_hash_fn() + let hash_fn = create_string_item_hash_fn() let items = [dog, cat, mouse, horse, pig, bull] - let mt = - from_list(items, hash_fn) + let mt = from_list(items, hash_fn) - let item = - "parrot" + let item = "parrot" - let proof = - get_proof(mt, item, hash_fn) + let proof = get_proof(mt, item, hash_fn) proof == None } fn get_proof_item_value(proof_item: ProofItem) -> Hash { when proof_item is { - Left(x) -> - x - Right(y) -> - y + Left(x) -> x + Right(y) -> y } } diff --git a/examples/acceptance_tests/068/aiken.lock b/examples/acceptance_tests/068/aiken.lock index c92b21fe..9fac4c34 100644 --- a/examples/acceptance_tests/068/aiken.lock +++ b/examples/acceptance_tests/068/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181064, nanos_since_epoch = 977089000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743643, nanos_since_epoch = 186230000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/068/lib/tests.ak b/examples/acceptance_tests/068/lib/tests.ak index d83f71c3..3af1365d 100644 --- a/examples/acceptance_tests/068/lib/tests.ak +++ b/examples/acceptance_tests/068/lib/tests.ak @@ -40,8 +40,7 @@ pub fn add(left v0: Value, right v1: Value) -> Value { a0, a1, fn(_, q0, q1) { - let q = - q0 + q1 + let q = q0 + q1 if q == 0 { None } else { @@ -78,8 +77,7 @@ pub fn flatten_with( assets, fn(asset_name, quantity, xs) { when transform(policy_id, asset_name, quantity) is { - None -> - xs + None -> xs Some(x) -> [x, ..xs] } diff --git a/examples/acceptance_tests/069/aiken.lock b/examples/acceptance_tests/069/aiken.lock index c123b6dd..9ccc3292 100644 --- a/examples/acceptance_tests/069/aiken.lock +++ b/examples/acceptance_tests/069/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705179899, nanos_since_epoch = 505049000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743643, nanos_since_epoch = 242458000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/071/aiken.lock b/examples/acceptance_tests/071/aiken.lock index 446320ef..dc38d449 100644 --- a/examples/acceptance_tests/071/aiken.lock +++ b/examples/acceptance_tests/071/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181045, nanos_since_epoch = 255817000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743640, nanos_since_epoch = 944756000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/071/plutus.json b/examples/acceptance_tests/071/plutus.json index 537b085a..fbeb4a67 100644 --- a/examples/acceptance_tests/071/plutus.json +++ b/examples/acceptance_tests/071/plutus.json @@ -5,7 +5,7 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.21-alpha+0161cf6" + "version": "v1.0.21-alpha+bf96c3a" } }, "validators": [ diff --git a/examples/acceptance_tests/071/validators/spend.ak b/examples/acceptance_tests/071/validators/spend.ak index d039e0e5..368a2d5a 100644 --- a/examples/acceptance_tests/071/validators/spend.ak +++ b/examples/acceptance_tests/071/validators/spend.ak @@ -69,13 +69,10 @@ pub fn validate_pool_deposit( datum: PoolDatum, redeemer: PoolDepositRedeemer, ) -> Bool { - let validator_address = - scripthash_address(#"ff") + let validator_address = scripthash_address(#"ff") - expect Some(pool_output) = - get_output(ctx, validator_address) - expect Some(pool_input) = - get_input(ctx, validator_address) + expect Some(pool_output) = get_output(ctx, validator_address) + expect Some(pool_input) = get_input(ctx, validator_address) True } @@ -86,34 +83,28 @@ pub fn validate_pool_borrow( datum: PoolDatum, redeemer: PoolBorrowRedeemer, ) -> Bool { - let validator_address = - scripthash_address(#"ff") + let validator_address = scripthash_address(#"ff") - expect Some(pool_output) = - get_output(ctx, validator_address) - expect Some(pool_input) = - get_input(ctx, validator_address) + expect Some(pool_output) = get_output(ctx, validator_address) + expect Some(pool_input) = get_input(ctx, validator_address) True } validator { fn pool_contract(datum: PoolDatum, redeemer: PoolRedeemer, ctx: ScriptContext) { when redeemer.action is { - PoolWithdraw(_) -> - True + PoolWithdraw(_) -> True PoolDeposit(pool_deposit_redeemer) -> when ctx.purpose is { Spend(output_ref) -> validate_pool_deposit(ctx, output_ref, datum, pool_deposit_redeemer) - _ -> - False + _ -> False } PoolBorrow(pool_borrow_redeemer) -> when ctx.purpose is { Spend(output_ref) -> validate_pool_borrow(ctx, output_ref, datum, pool_borrow_redeemer) - _ -> - False + _ -> False } } } diff --git a/examples/acceptance_tests/072/aiken.lock b/examples/acceptance_tests/072/aiken.lock index 983c2fe5..842464ed 100644 --- a/examples/acceptance_tests/072/aiken.lock +++ b/examples/acceptance_tests/072/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181059, nanos_since_epoch = 86246000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743642, nanos_since_epoch = 736511000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/072/lib/tests.ak b/examples/acceptance_tests/072/lib/tests.ak index 7e373828..6c7b03a1 100644 --- a/examples/acceptance_tests/072/lib/tests.ak +++ b/examples/acceptance_tests/072/lib/tests.ak @@ -30,34 +30,24 @@ fn find_outbound_datum(possible_output: Option) -> Data { when possible_output is { Some(possible_output) -> when possible_output.datum is { - InlineDatum(outbound_datum) -> - outbound_datum - _ -> - error @"expected outbound inline datum" + InlineDatum(outbound_datum) -> outbound_datum + _ -> fail @"expected outbound inline datum" } - None -> - error @"no outbound datum found" + None -> fail @"no outbound datum found" } } fn datum_a_cont() -> OtherDatum { - let owner: OwnerInfo = - OwnerInfo { pkh: #"", sc: #"" } - let have: TokenInfo = - TokenInfo { pid: #"", tkn: #"", amt: 100 } - let want: TokenInfo = - TokenInfo { pid: #"acab", tkn: #"beef", amt: 50 } - let info: SwapInfo = - SwapInfo { slip: 40 } + let owner: OwnerInfo = OwnerInfo { pkh: #"", sc: #"" } + let have: TokenInfo = TokenInfo { pid: #"", tkn: #"", amt: 100 } + let want: TokenInfo = TokenInfo { pid: #"acab", tkn: #"beef", amt: 50 } + let info: SwapInfo = SwapInfo { slip: 40 } OtherDatum { owner, have, want, info } } test foo() { - let outbound_datum = - InlineDatum(datum_a_cont()) - let outbound_output = - Some(Output { datum: outbound_datum }) - expect outbound_datum: OtherDatum = - find_outbound_datum(outbound_output) + let outbound_datum = InlineDatum(datum_a_cont()) + let outbound_output = Some(Output { datum: outbound_datum }) + expect outbound_datum: OtherDatum = find_outbound_datum(outbound_output) outbound_datum == datum_a_cont() } diff --git a/examples/acceptance_tests/074/aiken.lock b/examples/acceptance_tests/074/aiken.lock index aa4b3d49..c31cd7f9 100644 --- a/examples/acceptance_tests/074/aiken.lock +++ b/examples/acceptance_tests/074/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181056, nanos_since_epoch = 151986000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743642, nanos_since_epoch = 350520000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/074/lib/tests.ak b/examples/acceptance_tests/074/lib/tests.ak index d82f81c3..e71f9b5d 100644 --- a/examples/acceptance_tests/074/lib/tests.ak +++ b/examples/acceptance_tests/074/lib/tests.ak @@ -25,12 +25,9 @@ pub type ProofItem { // Function returning a hash of a given Merkle Tree element pub fn root_hash(self: MerkleTree) -> Hash { when self is { - Empty -> - #"" - Leaf { hash } -> - hash - Node { hash, .. } -> - hash + Empty -> #"" + Leaf { hash } -> hash + Node { hash, .. } -> hash } } @@ -42,12 +39,9 @@ pub fn is_equal(left: MerkleTree, right: MerkleTree) -> Bool { /// Function returns a total numbers of leaves in the tree. pub fn size(self: MerkleTree) -> Int { when self is { - Empty -> - 0 - Leaf { .. } -> - 1 - Node { left, right, .. } -> - size(left) + size(right) + Empty -> 0 + Leaf { .. } -> 1 + Node { left, right, .. } -> size(left) + size(right) } } @@ -61,10 +55,8 @@ fn combine_hash( /// Function that returns whether merkle tree has any elements pub fn is_empty(self: MerkleTree) -> Bool { when self is { - Empty -> - True - _ -> - False + Empty -> True + _ -> False } } @@ -75,8 +67,7 @@ fn do_proof( serialise_fn: fn(a) -> ByteArray, ) -> Option { when self is { - Empty -> - None + Empty -> None Leaf { hash } -> if hash == item_hash { Some(proof) @@ -84,10 +75,8 @@ fn do_proof( None } Node { left, right, .. } -> { - let rh = - root_hash(right) - let lh = - root_hash(left) + let rh = root_hash(right) + let lh = root_hash(left) let go_left: Option = do_proof( left, @@ -127,16 +116,13 @@ fn do_from_list( serialise_fn: fn(a) -> ByteArray, ) -> MerkleTree { when items is { - [] -> - Empty + [] -> Empty [item] -> { - let hashed_item = - sha2_256(serialise_fn(item)) + let hashed_item = sha2_256(serialise_fn(item)) Leaf { hash: hashed_item } } all -> { - let cutoff: Int = - len / 2 + let cutoff: Int = len / 2 let left = all |> list.take(cutoff) @@ -145,8 +131,7 @@ fn do_from_list( all |> list.drop(cutoff) |> do_from_list(len - cutoff, serialise_fn) - let hash = - combine_hash(root_hash(left), root_hash(right)) + let hash = combine_hash(root_hash(left), root_hash(right)) Node { hash, left, right } } } @@ -167,13 +152,10 @@ fn do_from_hashes_list( len: Int, ) -> MerkleTree { when items is { - [] -> - Empty - [hashed_item] -> - Leaf { hash: hashed_item } + [] -> Empty + [hashed_item] -> Leaf { hash: hashed_item } all -> { - let cutoff: Int = - len / 2 + let cutoff: Int = len / 2 let left = all |> list.take(cutoff) @@ -182,8 +164,7 @@ fn do_from_hashes_list( all |> list.drop(cutoff) |> do_from_hashes_list(len - cutoff) - let hash = - combine_hash(root_hash(left), root_hash(right)) + let hash = combine_hash(root_hash(left), root_hash(right)) Node { hash, left, right } } } @@ -207,8 +188,7 @@ pub fn member_from_hash( serialise_fn: fn(a) -> ByteArray, ) -> Bool { when proof is { - [] -> - root_hash == item_hash + [] -> root_hash == item_hash [head, ..tail] -> when head is { Left { hash: l } -> @@ -237,8 +217,7 @@ pub fn member( proof: Proof, serialise_fn: fn(a) -> ByteArray, ) -> Bool { - let item_hash = - sha2_256(serialise_fn(item)) + let item_hash = sha2_256(serialise_fn(item)) member_from_hash(item_hash, root_hash, proof, serialise_fn) } @@ -247,16 +226,12 @@ pub fn member_from_tree( item: a, serialise_fn: fn(a) -> ByteArray, ) -> Bool { - let proof: Option = - get_proof(tree, item, serialise_fn) - let rh = - root_hash(tree) + let proof: Option = get_proof(tree, item, serialise_fn) + let rh = root_hash(tree) when proof is { - Some(p) -> - member(item, rh, p, serialise_fn) - None -> - False + Some(p) -> member(item, rh, p, serialise_fn) + None -> False } } @@ -266,25 +241,18 @@ fn create_string_item_serialise_fn() -> fn(String) -> ByteArray { } test from_hashes_list_5() { - let dog = - @"dog" - let cat = - @"cat" - let mouse = - @"mouse" - let horse = - @"horse" + let dog = @"dog" + let cat = @"cat" + let mouse = @"mouse" + let horse = @"horse" - let serialise_fn = - create_string_item_serialise_fn() + let serialise_fn = create_string_item_serialise_fn() let items = [dog, cat, mouse, horse] - let hashes_items = - list.map(items, fn(item) { sha2_256(serialise_fn(item)) }) + let hashes_items = list.map(items, fn(item) { sha2_256(serialise_fn(item)) }) - let mt = - from_hashes_list(hashes_items) + let mt = from_hashes_list(hashes_items) let left_node_hash = sha2_256( @@ -298,8 +266,7 @@ test from_hashes_list_5() { ), ) - let root_hash = - sha2_256(bytearray.concat(left_node_hash, right_node_hash)) + let root_hash = sha2_256(bytearray.concat(left_node_hash, right_node_hash)) Node { hash: root_hash, diff --git a/examples/acceptance_tests/076/lib/tests.ak b/examples/acceptance_tests/076/lib/tests.ak index 6976e7a7..b6481d4c 100644 --- a/examples/acceptance_tests/076/lib/tests.ak +++ b/examples/acceptance_tests/076/lib/tests.ak @@ -1,6 +1,6 @@ test expect_positive() { let val = 5 - expect True = val > 0 + expect val > 0 True } diff --git a/examples/acceptance_tests/077/aiken.lock b/examples/acceptance_tests/077/aiken.lock index 47d303a4..acbdfc24 100644 --- a/examples/acceptance_tests/077/aiken.lock +++ b/examples/acceptance_tests/077/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181044, nanos_since_epoch = 445717000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743640, nanos_since_epoch = 940487000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/077/plutus.json b/examples/acceptance_tests/077/plutus.json index 3c0eaa89..34c3d7f0 100644 --- a/examples/acceptance_tests/077/plutus.json +++ b/examples/acceptance_tests/077/plutus.json @@ -5,7 +5,7 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.21-alpha+0161cf6" + "version": "v1.0.21-alpha+bf96c3a" } }, "validators": [ diff --git a/examples/acceptance_tests/077/validators/spend.ak b/examples/acceptance_tests/077/validators/spend.ak index 573302ce..86ca3f22 100644 --- a/examples/acceptance_tests/077/validators/spend.ak +++ b/examples/acceptance_tests/077/validators/spend.ak @@ -1,38 +1,31 @@ -use aiken/list.{find, foldr} -use aiken/transaction.{Input, ScriptContext, Spend, OutputReference, Transaction} as tx -use aiken/transaction/value.{add, zero} use aiken/dict +use aiken/list.{find, foldr} +use aiken/transaction.{Input, + OutputReference, ScriptContext, Spend, Transaction} as tx +use aiken/transaction/value.{add, zero} - type Action { Mint Burn } - + validator(token_name: ByteArray, utxo_ref: OutputReference) { fn gift_card(rdmr: Action, ctx: ScriptContext) -> Bool { - let ScriptContext { transaction, purpose } = - ctx - - expect tx.Mint(policy_id) = - purpose - - let Transaction { inputs, mint, .. } = - transaction - - expect [(asset_name, amount)] = mint + let ScriptContext { transaction, purpose } = ctx + expect tx.Mint(policy_id) = purpose + let Transaction { inputs, mint, .. } = transaction + expect [(asset_name, amount)] = + mint |> value.from_minted_value |> value.tokens(policy_id) |> dict.to_list() - when rdmr is { Mint -> { - expect True = + expect list.any(inputs, fn(input) { input.output_reference == utxo_ref }) amount == 1 && asset_name == token_name } - Burn -> - todo @"burn" + Burn -> todo @"burn" } } } diff --git a/examples/acceptance_tests/078/lib/tests.ak b/examples/acceptance_tests/078/lib/tests.ak index 4302864b..a8a6bad3 100644 --- a/examples/acceptance_tests/078/lib/tests.ak +++ b/examples/acceptance_tests/078/lib/tests.ak @@ -10,10 +10,8 @@ type DayOfTheWeek { fn is_work(day: DayOfTheWeek) { when day is { - Tuesday | Wednesday | Thursday | Friday | Saturday -> - True - _ -> - False + Tuesday | Wednesday | Thursday | Friday | Saturday -> True + _ -> False } } @@ -27,12 +25,10 @@ test is_work_2() { fn is_happy_hour(day: DayOfTheWeek, current_time: Int) { when day is { - Monday | Sunday -> - True + Monday | Sunday -> True Tuesday | Wednesday | Thursday | Friday | Saturday if current_time > 18 -> True - _ -> - False + _ -> False } } diff --git a/examples/acceptance_tests/079/plutus.json b/examples/acceptance_tests/079/plutus.json index 64df444f..148ef12a 100644 --- a/examples/acceptance_tests/079/plutus.json +++ b/examples/acceptance_tests/079/plutus.json @@ -5,7 +5,7 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.21-alpha+0161cf6" + "version": "v1.0.21-alpha+bf96c3a" } }, "validators": [ diff --git a/examples/acceptance_tests/082/aiken.lock b/examples/acceptance_tests/082/aiken.lock index 978e59a0..95d1c9fd 100644 --- a/examples/acceptance_tests/082/aiken.lock +++ b/examples/acceptance_tests/082/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181045, nanos_since_epoch = 361146000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743640, nanos_since_epoch = 972182000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/082/lib/tests.ak b/examples/acceptance_tests/082/lib/tests.ak index 0126438b..c8ff12e1 100644 --- a/examples/acceptance_tests/082/lib/tests.ak +++ b/examples/acceptance_tests/082/lib/tests.ak @@ -149,36 +149,36 @@ test satisfying() { !satisfied(n, s, v) } and { - satisfied(sig1, [keyHash1], validRange(0, 1))?, - satisfied(sig2, [keyHash1, keyHash2], validRange(0, 1))?, - satisfied(allOf, [keyHash1, keyHash2], validRange(0, 1))?, - satisfied(anyOf, [keyHash2], validRange(0, 1))?, - satisfied(atLeast, [keyHash2, keyHash3], validRange(0, 1))?, - satisfied(before, [], validRange(0, 5))?, - satisfied(after, [], validRange(15, 20))?, - satisfied(after, [], validRange(10, 15))?, - satisfied(between, [], validRange(12, 13))?, - satisfied(vesting, [keyHash1], validRange(0, 5))?, - satisfied(vesting, [keyHash2], validRange(15, 20))?, - unsatisfied(sig1, [keyHash2], validRange(0, 1))?, - unsatisfied(sig3, [keyHash1, keyHash2], validRange(0, 1))?, - unsatisfied(allOf, [keyHash1, keyHash3], validRange(0, 1))?, - unsatisfied(anyOf, [keyHash3], validRange(0, 1))?, - unsatisfied(atLeast, [keyHash2], validRange(0, 1))?, - unsatisfied(before, [], validRange(5, 15))?, - unsatisfied(before, [], validRange(5, 10))?, - unsatisfied(before, [], validRange(10, 10))?, - unsatisfied(after, [], validRange(5, 15))?, - unsatisfied(between, [], validRange(0, 5))?, - unsatisfied(between, [], validRange(0, 13))?, - unsatisfied(between, [], validRange(0, 20))?, - unsatisfied(between, [], validRange(13, 20))?, - unsatisfied(between, [], validRange(13, 15))?, - unsatisfied(between, [], validRange(15, 20))?, - unsatisfied(vesting, [keyHash2], validRange(0, 5))?, - unsatisfied(vesting, [keyHash1], validRange(15, 20))?, - unsatisfied(vesting, [keyHash3], validRange(10, 10))?, - unsatisfied(vesting, [keyHash3], validRange(0, 5))?, - unsatisfied(vesting, [keyHash3], validRange(15, 20))?, + satisfied(sig1, [keyHash1], validRange(0, 1))?, + satisfied(sig2, [keyHash1, keyHash2], validRange(0, 1))?, + satisfied(allOf, [keyHash1, keyHash2], validRange(0, 1))?, + satisfied(anyOf, [keyHash2], validRange(0, 1))?, + satisfied(atLeast, [keyHash2, keyHash3], validRange(0, 1))?, + satisfied(before, [], validRange(0, 5))?, + satisfied(after, [], validRange(15, 20))?, + satisfied(after, [], validRange(10, 15))?, + satisfied(between, [], validRange(12, 13))?, + satisfied(vesting, [keyHash1], validRange(0, 5))?, + satisfied(vesting, [keyHash2], validRange(15, 20))?, + unsatisfied(sig1, [keyHash2], validRange(0, 1))?, + unsatisfied(sig3, [keyHash1, keyHash2], validRange(0, 1))?, + unsatisfied(allOf, [keyHash1, keyHash3], validRange(0, 1))?, + unsatisfied(anyOf, [keyHash3], validRange(0, 1))?, + unsatisfied(atLeast, [keyHash2], validRange(0, 1))?, + unsatisfied(before, [], validRange(5, 15))?, + unsatisfied(before, [], validRange(5, 10))?, + unsatisfied(before, [], validRange(10, 10))?, + unsatisfied(after, [], validRange(5, 15))?, + unsatisfied(between, [], validRange(0, 5))?, + unsatisfied(between, [], validRange(0, 13))?, + unsatisfied(between, [], validRange(0, 20))?, + unsatisfied(between, [], validRange(13, 20))?, + unsatisfied(between, [], validRange(13, 15))?, + unsatisfied(between, [], validRange(15, 20))?, + unsatisfied(vesting, [keyHash2], validRange(0, 5))?, + unsatisfied(vesting, [keyHash1], validRange(15, 20))?, + unsatisfied(vesting, [keyHash3], validRange(10, 10))?, + unsatisfied(vesting, [keyHash3], validRange(0, 5))?, + unsatisfied(vesting, [keyHash3], validRange(15, 20))?, } } diff --git a/examples/acceptance_tests/083/aiken.lock b/examples/acceptance_tests/083/aiken.lock index ce8dd54a..68703a3a 100644 --- a/examples/acceptance_tests/083/aiken.lock +++ b/examples/acceptance_tests/083/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181044, nanos_since_epoch = 445541000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743640, nanos_since_epoch = 966665000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/083/lib/tests.ak b/examples/acceptance_tests/083/lib/tests.ak index 50b2dab9..3ec19658 100644 --- a/examples/acceptance_tests/083/lib/tests.ak +++ b/examples/acceptance_tests/083/lib/tests.ak @@ -27,7 +27,7 @@ fn compare_value( if value.quantity_of(val1, sym, loan_id) == value.quantity_of(val2, sym, loan_id){ - error @"Should not be equal" + fail @"Should not be equal" } else { Less } diff --git a/examples/acceptance_tests/084/aiken.lock b/examples/acceptance_tests/084/aiken.lock index 6391604e..fb4e49b4 100644 --- a/examples/acceptance_tests/084/aiken.lock +++ b/examples/acceptance_tests/084/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181045, nanos_since_epoch = 301366000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743640, nanos_since_epoch = 968996000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/085/aiken.lock b/examples/acceptance_tests/085/aiken.lock index a4b5dbbb..7adcdd84 100644 --- a/examples/acceptance_tests/085/aiken.lock +++ b/examples/acceptance_tests/085/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181045, nanos_since_epoch = 320068000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743640, nanos_since_epoch = 975570000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/086/aiken.lock b/examples/acceptance_tests/086/aiken.lock index 520c98ac..18896382 100644 --- a/examples/acceptance_tests/086/aiken.lock +++ b/examples/acceptance_tests/086/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181059, nanos_since_epoch = 76573000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743642, nanos_since_epoch = 725442000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/086/plutus.json b/examples/acceptance_tests/086/plutus.json index c306cab0..9ab229fe 100644 --- a/examples/acceptance_tests/086/plutus.json +++ b/examples/acceptance_tests/086/plutus.json @@ -5,7 +5,7 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.21-alpha+0161cf6" + "version": "v1.0.21-alpha+bf96c3a" } }, "validators": [ diff --git a/examples/acceptance_tests/087/aiken.lock b/examples/acceptance_tests/087/aiken.lock index 4dc9cf5c..1c247db6 100644 --- a/examples/acceptance_tests/087/aiken.lock +++ b/examples/acceptance_tests/087/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181055, nanos_since_epoch = 546831000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743642, nanos_since_epoch = 191574000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/088/aiken.lock b/examples/acceptance_tests/088/aiken.lock index a444a2d5..45537f0c 100644 --- a/examples/acceptance_tests/088/aiken.lock +++ b/examples/acceptance_tests/088/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181060, nanos_since_epoch = 328311000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743642, nanos_since_epoch = 768373000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/089/aiken.lock b/examples/acceptance_tests/089/aiken.lock index 03c0cc04..6361d985 100644 --- a/examples/acceptance_tests/089/aiken.lock +++ b/examples/acceptance_tests/089/aiken.lock @@ -13,4 +13,4 @@ requirements = [] source = "github" [etags] -"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705181054, nanos_since_epoch = 373675000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] +"aiken-lang/stdlib@main" = [{ secs_since_epoch = 1705743642, nanos_since_epoch = 175324000 }, "cf946239d3dd481ed41f20e56bf24910b5229ea35aa171a708edc2a47fc20a7b"] diff --git a/examples/acceptance_tests/090/plutus.json b/examples/acceptance_tests/090/plutus.json index a6a24507..f6ece1dd 100644 --- a/examples/acceptance_tests/090/plutus.json +++ b/examples/acceptance_tests/090/plutus.json @@ -5,7 +5,7 @@ "plutusVersion": "v2", "compiler": { "name": "Aiken", - "version": "v1.0.21-alpha+9f263c4" + "version": "v1.0.21-alpha+bf96c3a" } }, "validators": [