Skip to content
Snippets Groups Projects
Commit 8da430f5 authored by Ivar Härnqvist's avatar Ivar Härnqvist
Browse files

add find_result_keys_by_name utility function

parent c117d89a
No related branches found
No related tags found
2 merge requests!67WIP: B-ASIC version 1.0.0 hotfix,!65B-ASIC version 1.0.0
Pipeline #16118 failed
File deleted
This diff is collapsed.
import pytest import pytest
import numpy as np import numpy as np
<<<<<<< HEAD from b_asic import SFG, Output, Simulation
from b_asic import SFG, Input, Output, Delay, ConstantMultiplication, Simulation
=======
from b_asic import SFG, Simulation
>>>>>>> d2ae5743259f581c116bb3772d17c3b2023ed9e0
class TestRunFor: class TestRunFor:
...@@ -126,17 +122,11 @@ class TestRunFor: ...@@ -126,17 +122,11 @@ class TestRunFor:
assert simulation.results["0"][4] == -6 assert simulation.results["0"][4] == -6
assert simulation.results["0"][5] == 7 assert simulation.results["0"][5] == 7
def test_find_result_key(self): def test_find_result_key(self, precedence_sfg_delays):
indata = [77, 99, 0.3, 23, 88, 3.14, 4.76, 45, 0.099] sim = Simulation(precedence_sfg_delays, [[0, 4, 542, 42, 31.314, 534.123, -453415, 5431]])
i = Input()
d = Delay()
m = ConstantMultiplication(0.5, d, "Mult")
d << (m + i)
o = Output(d)
s = SFG(inputs=[i], outputs=[o])
sim = Simulation(s, [indata])
sim.run() sim.run()
assert sim.results[s.find_result_keys_by_name("Mult")[0]][4] == 0.35 assert sim.results[precedence_sfg_delays.find_result_keys_by_name("ADD2")[0]][4] == 31220
assert sim.results[precedence_sfg_delays.find_result_keys_by_name("A1")[0]][2] == 80
class TestRun: class TestRun:
def test_save_results(self, sfg_two_inputs_two_outputs): def test_save_results(self, sfg_two_inputs_two_outputs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment