Fix some tests. Remove optimization of singleton tuples

This commit is contained in:
radrow
2021-05-11 11:39:33 +02:00
parent 5c43be22b9
commit b1b2dc849a
8 changed files with 32 additions and 42 deletions
+3 -1
View File
@@ -5,13 +5,15 @@ contract interface HigherOrderState =
stateful entrypoint inc : int => unit
contract interface LowerDisorderAnarchy =
entrypoint init : int => void
entrypoint init : (int) => void
main contract C =
// both `s` and `l` should be of type `HigherOrderState` in this test
stateful entrypoint run_clone(s : HigherOrderState, l : LowerDisorderAnarchy) : HigherOrderState =
let s1 = Chain.clone(ref=s)
let Some(s2) = Chain.clone(ref=s, protected=true)
let None = Chain.clone(ref=s, protected=true, gas=1)
let None = Chain.clone(ref=l, protected=true, 123)
let s3 = Chain.clone(ref=s1)
require(s1.apply(2137) == 2137, "APPLY_S1_0")
+1 -1
View File
@@ -2,6 +2,6 @@ contract interface I =
entrypoint init : () => void
contract C =
entrypoint f(i : I) =
stateful entrypoint f(i : I) =
let Some(c1) = Chain.clone(ref=i, protected = true)
2
+11 -25
View File
@@ -1,28 +1,14 @@
contract T =
entrypoint f(x, y) = 3
main contract IntegerAdderFactory =
stateful payable entrypoint calculateSomething(x, t) =
// let t = Chain.create(value = 5555) : T
t.f(protected = true, gas = 999999999, value = 777777, 111, 222)
// t.f()
include "List.aes"
/*
contract IntegerAdder =
entrypoint init() = ()
entrypoint addIntegers(x, y) = x + y
contract IntegerAdderHolder =
type state = IntegerAdder
entrypoint init() = Chain.create() : IntegerAdder
contract IntegerHolder =
type state = int
entrypoint init(x) = x
entrypoint get() = state
namespace IntegerAdderFactory =
function new() =
let i = Chain.create() : IntegerAdderHolder
i.get()
main contract EnterpriseContract =
entrypoint calculateSomething(x) =
let adder = IntegerAdderFactory.new()
adder.addIntegers(x, 2137)
*/
main contract IntegerCollection =
record state = {template: IntegerHolder, payload: list(IntegerHolder)}
stateful entrypoint init() = {template = Chain.create(0), payload = []}
stateful entrypoint add(x) =
put(state{payload @ p = Chain.clone(ref=state.template, x) :: p})
x
entrypoint sum() = List.sum(List.map((h) => h.get(), state.payload))