Skip to content
Snippets Groups Projects
Commit 2b90137b authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Add test adding the output of two SFGs

parent 80b6affa
No related branches found
No related tags found
1 merge request!268Add test adding the output of two SFGs
Pipeline #93486 passed
...@@ -11,15 +11,10 @@ import pytest ...@@ -11,15 +11,10 @@ import pytest
from b_asic import SFG, Input, Output, Signal from b_asic import SFG, Input, Output, Signal
from b_asic.core_operations import ( from b_asic.core_operations import (
Absolute,
Addition, Addition,
Butterfly, Butterfly,
ComplexConjugate,
Constant, Constant,
ConstantMultiplication, ConstantMultiplication,
Division,
Max,
Min,
Multiplication, Multiplication,
SquareRoot, SquareRoot,
Subtraction, Subtraction,
...@@ -945,6 +940,31 @@ class TestConnectExternalSignalsToComponentsMultipleComp: ...@@ -945,6 +940,31 @@ class TestConnectExternalSignalsToComponentsMultipleComp:
assert test_sfg.evaluate(1, 2, 3, 4) == 16 assert test_sfg.evaluate(1, 2, 3, 4) == 16
assert not test_sfg.connect_external_signals_to_components() assert not test_sfg.connect_external_signals_to_components()
def test_add_two_sfgs(self):
c1 = ConstantMultiplication(0.5)
c1_sfg = c1.to_sfg()
c2 = ConstantMultiplication(0.5)
c2_sfg = c2.to_sfg()
in1 = Input()
in2 = Input()
output = Output(c1_sfg + c2_sfg)
c1_sfg << in1
c2_sfg << in2
sfg = SFG([in1, in2], [output])
assert not sfg.find_by_type_name(ConstantMultiplication.type_name())
c1_sfg.connect_external_signals_to_components()
sfg = SFG([in1, in2], [output])
assert len(sfg.find_by_type_name(ConstantMultiplication.type_name())) == 1
c2_sfg.connect_external_signals_to_components()
sfg = SFG([in1, in2], [output])
assert len(sfg.find_by_type_name(ConstantMultiplication.type_name())) == 2
class TestTopologicalOrderOperations: class TestTopologicalOrderOperations:
def test_feedback_sfg(self, sfg_simple_filter): def test_feedback_sfg(self, sfg_simple_filter):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment