Skip to content
Snippets Groups Projects
Commit 4f48765e authored by Hugo Winbladh's avatar Hugo Winbladh Committed by Oscar Gustafsson
Browse files

raise exception for Sink.evaluate() and add simple test

parent dead8fed
No related branches found
No related tags found
1 merge request!425Add a sink operation to avoid dangling nodes
Pipeline #102905 passed
This commit is part of merge request !425. Comments created here will be created in the context of that merge request.
......@@ -1278,7 +1278,6 @@ class Sink(AbstractOperation):
_execution_time = 0
is_linear = True
is_constant = True
def __init__(self, name: Name = ""):
"""Construct a Sink operation."""
......@@ -1294,7 +1293,7 @@ class Sink(AbstractOperation):
return TypeName("sink")
def evaluate(self):
return self.param("value")
raise NotImplementedError
@property
def latency(self) -> int:
......
......@@ -20,6 +20,8 @@ from b_asic import (
SquareRoot,
Subtraction,
SymmetricTwoportAdaptor,
Sink,
SFG,
)
......@@ -404,3 +406,16 @@ class TestDepends:
bfly1 = Butterfly()
assert set(bfly1.inputs_required_for_output(0)) == {0, 1}
assert set(bfly1.inputs_required_for_output(1)) == {0, 1}
class TestSink:
def test_create_sfg_with_sink(self):
bfly = Butterfly()
sfg = bfly.to_sfg()
s = Sink()
sfg1 = sfg.replace_operation(s, "out0")
sfg2 = SFG(sfg1.input_operations, sfg1.output_operations[1:])
assert sfg2.output_count == 1
assert sfg2.input_count == 2
assert sfg.evaluate_output(1, [0,1]) == sfg2.evaluate_output(0, [0,1])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment