1import smartpy as sp
2
3
4@sp.module
5def t():
6 r: type = sp.record(a=sp.nat, b=sp.nat)
7
8
9@sp.module
10def main():
11 class A(sp.Contract):
12 def __init__(self, r):
13 sp.cast(r, t.r)
14 self.data.r = r
15
16 @sp.entrypoint
17 def ep(self, r):
18 self.data.r = r
19
20
21@sp.add_test()
22def test():
23 s = sp.test_scenario("Test1", [t, main])
24 a1 = main.A(sp.record(a=1, b=2))
25 s += a1
26
27
28@sp.add_test()
29def test():
30 s = sp.test_scenario("Test2", [t])
31 s.add_module(main)
32 a1 = main.A(sp.record(a=1, b=2))
33 s += a1