<reponame>ktok07b6/polyphony<filename>tests/class/param05.py<gh_stars>10-100
from polyphony import testbench

class C:
    def __init__(self, v):
        self.v = v

class D:
    def __init__(self, c):
        self.c = c

class E:
    def __init__(self, d):
        self.d = d

def param05(p, x, y):
    c1 = C(x)
    c2 = C(y)    
    d1 = D(c1)
    d2 = D(c2)
    if p:
        e = E(d1)
    else:
        e = E(d2)
    return e.d.c.v

@testbench
def test():
    assert 1 == param05(True, 1, 2)
    assert 2 == param05(True, 2, 3)
    assert 2 == param05(False, 1, 2)
    assert 3 == param05(False, 2, 3)
    
test()

from polyphony import testbench

class C:
    def __init__(self, v):
        self.v = v

class D:
    def __init__(self, c):
        self.c = c

class E:
    def __init__(self, d):
        self.d = d

def param05(p, x, y):
    c1 = C(x)
    c2 = C(y)    
    d1 = D(c1)
    d2 = D(c2)
    if p:
        e = E(d1)
    else:
        e = E(d2)
    return e.d.c.v

@testbench
def test():
    assert 1 == param05(True, 1, 2)
    assert 2 == param05(True, 2, 3)
    assert 2 == param05(False, 1, 2)
    assert 3 == param05(False, 2, 3)
    
test()