Skip to content
Snippets Groups Projects
Commit 3d178c98 authored by Kevin Scott's avatar Kevin Scott
Browse files

Added comments for fixtures

parent 96a9b53e
No related branches found
No related tags found
3 merge requests!67WIP: B-ASIC version 1.0.0 hotfix,!65B-ASIC version 1.0.0,!15Add changes from sprint 1 and 2 to master
Pipeline #10232 passed
......@@ -17,6 +17,12 @@ def create_operation(_type, dest_oper, index, **kwargs):
@pytest.fixture
def operation_tree():
"""
Return a addition operation connected with 2 constants.
>---C---+
---A
>---C---+
"""
add_oper = Addition()
create_operation(Constant, add_oper, 0, value=2)
create_operation(Constant, add_oper, 1, value=3)
......@@ -24,6 +30,16 @@ def operation_tree():
@pytest.fixture
def large_operation_tree():
"""
Return a constant operation connected with a large operation tree with 3 other constants and 3 additions.
>---C---+
---A---+
>---C---+ |
+---A
>---C---+ |
---A---+
>---C---+
"""
add_oper = Addition()
add_oper_2 = Addition()
......
......@@ -3,8 +3,10 @@ from b_asic import Signal
@pytest.fixture
def signal():
"""Return a signal with no connections."""
return Signal()
@pytest.fixture
def signals():
"""Return 3 signals with no connections."""
return [Signal() for _ in range(0,3)]
......@@ -6,22 +6,23 @@ from b_asic.graph_id import GraphIDGenerator, GraphID
import pytest
def test_empty_string_generator():
@pytest.fixture
def graph_id_generator():
return GraphIDGenerator()
def test_empty_string_generator(graph_id_generator):
"""Test the graph id generator for an empty string type."""
graph_id_generator = GraphIDGenerator()
assert graph_id_generator.get_next_id("") == "1"
assert graph_id_generator.get_next_id("") == "2"
def test_normal_string_generator():
def test_normal_string_generator(graph_id_generator):
""""Test the graph id generator for a normal string type."""
graph_id_generator = GraphIDGenerator()
assert graph_id_generator.get_next_id("add") == "add1"
assert graph_id_generator.get_next_id("add") == "add2"
def test_different_strings_generator():
def test_different_strings_generator(graph_id_generator):
"""Test the graph id generator for different strings."""
graph_id_generator = GraphIDGenerator()
assert graph_id_generator.get_next_id("sub") == "sub1"
assert graph_id_generator.get_next_id("mul") == "mul1"
assert graph_id_generator.get_next_id("sub") == "sub2"
......
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