AddTest
Adds two constant values to produce a sum of 3.
This component demonstrates basic component composition by connecting two constant sources (with values 1 and 2) to an adder block. The output of the adder (add.y) equals the sum of the two inputs (3).
Usage
AddTest()
Behavior
Source
dyad
# Adds two constant values to produce a sum of 3.
#
# This component demonstrates basic component composition by connecting two constant sources
# (with values 1 and 2) to an adder block. The output of the adder (add.y) equals the sum of
# the two inputs (3).
test component AddTest
# Constant source with value 1
c1 = Constant(k=1)
# Constant source with value 2
c2 = Constant(k=2)
# Adder that sums its two inputs
add = Add()
relations
# Connects the output of constant 1 to the first input of the adder
connect(add.u1, c1.y)
# Connects the output of constant 2 to the second input of the adder
connect(add.u2, c2.y)
metadata {"Dyad": {"tests": {"case1": {"stop": 5, "expect": {"final": {"add.y": 3}}}}}}
end
Flattened Source
dyad
# Adds two constant values to produce a sum of 3.
#
# This component demonstrates basic component composition by connecting two constant sources
# (with values 1 and 2) to an adder block. The output of the adder (add.y) equals the sum of
# the two inputs (3).
test component AddTest
# Constant source with value 1
c1 = Constant(k=1)
# Constant source with value 2
c2 = Constant(k=2)
# Adder that sums its two inputs
add = Add()
relations
# Connects the output of constant 1 to the first input of the adder
connect(add.u1, c1.y)
# Connects the output of constant 2 to the second input of the adder
connect(add.u2, c2.y)
metadata {"Dyad": {"tests": {"case1": {"stop": 5, "expect": {"final": {"add.y": 3}}}}}}
end