Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
3d178c98
Commit
3d178c98
authored
5 years ago
by
Kevin Scott
Browse files
Options
Downloads
Patches
Plain Diff
Added comments for fixtures
parent
96a9b53e
No related branches found
Branches containing commit
No related tags found
3 merge requests
!67
WIP: B-ASIC version 1.0.0 hotfix
,
!65
B-ASIC version 1.0.0
,
!15
Add changes from sprint 1 and 2 to master
Pipeline
#10232
passed
5 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/fixtures/operation_tree.py
+16
-0
16 additions, 0 deletions
test/fixtures/operation_tree.py
test/fixtures/signal.py
+2
-0
2 additions, 0 deletions
test/fixtures/signal.py
test/graph_id/test_graph_id_generator.py
+7
-6
7 additions, 6 deletions
test/graph_id/test_graph_id_generator.py
with
25 additions
and
6 deletions
test/fixtures/operation_tree.py
+
16
−
0
View file @
3d178c98
...
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
test/fixtures/signal.py
+
2
−
0
View file @
3d178c98
...
...
@@ -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
)]
This diff is collapsed.
Click to expand it.
test/graph_id/test_graph_id_generator.py
+
7
−
6
View file @
3d178c98
...
...
@@ -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
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment