templates.test_conditionals

 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 ep(self, params):
12            self.data.r = 1000 * (2 if params else 3)
13
14
15@sp.add_test()
16def test():
17    s = sp.test_scenario("Match", main)
18    c = main.C()
19    s += c
20    c.ep(True)
21    s.verify(c.data.r == 2000)
22    c.ep(False)
23    s.verify(c.data.r == 3000)