1import smartpy as sp
2
3
4@sp.module
5def main():
6 class C(sp.Contract):
7 def __init__(self):
8 self.data.r = 0
9
10 @sp.entrypoint
11 def ep1(self):
12 a = 1
13 b = 2
14 self.data.r = sp.min(a, b)
15
16 @sp.entrypoint
17 def ep2(self):
18 a = 3
19 b = 4
20 self.data.r = sp.max(a, b)
21
22 @sp.entrypoint
23 def ep1b(self, params):
24 a = params
25 b = 2
26 self.data.r = sp.min(a, b)
27
28 @sp.entrypoint
29 def ep2b(self, params):
30 a = params
31 b = 4
32 self.data.r = sp.max(a, b)
33
34
35@sp.add_test()
36def test():
37 scenario = sp.test_scenario("Min", main)
38 scenario.h1("Min / Max")
39 c = main.C()
40 scenario += c
41 c.ep1()
42 scenario.verify(c.data.r == 1)
43 c.ep2()
44 scenario.verify(c.data.r == 4)
45 c.ep1b(1)
46 scenario.verify(c.data.r == 1)
47 c.ep2b(3)
48 scenario.verify(c.data.r == 4)