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
Merge requests
!151
More SFG tests
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
More SFG tests
sfgtest2
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Oscar Gustafsson
requested to merge
sfgtest2
into
master
2 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Viewing commit
1fc492dc
Show latest version
1 file
+
52
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
1fc492dc
More SFG tests
· 1fc492dc
Oscar Gustafsson
authored
2 years ago
test/test_sfg.py
+
52
−
0
Options
import
io
import
random
import
re
import
string
import
sys
from
os
import
path
,
remove
@@ -627,10 +628,16 @@ class TestFindComponentsWithTypeName:
class
TestGetPrecedenceList
:
def
test_inputs_delays
(
self
,
precedence_sfg_delays
):
# No cached precedence list
assert
precedence_sfg_delays
.
_precedence_list
is
None
precedence_list
=
precedence_sfg_delays
.
get_precedence_list
()
assert
len
(
precedence_list
)
==
7
# Cached precedence list
assert
len
(
precedence_sfg_delays
.
_precedence_list
)
==
7
assert
set
(
[
port
.
operation
.
key
(
port
.
index
,
port
.
operation
.
name
)
@@ -680,6 +687,11 @@ class TestGetPrecedenceList:
]
)
==
{
"
ADD4
"
}
# Trigger cache
precedence_list
=
precedence_sfg_delays
.
get_precedence_list
()
assert
len
(
precedence_list
)
==
7
def
test_inputs_constants_delays_multiple_outputs
(
self
,
precedence_sfg_delays_and_constants
):
@@ -1510,3 +1522,43 @@ class TestSFGErrors:
signal
=
Signal
(
adaptor
.
output
(
1
))
# Should raise?
SFG
([
in1
,
in2
],
[
out1
],
output_signals
=
[
signal
,
signal
])
def
test_dangling_input_signal
(
self
):
in1
=
Input
()
signal
=
Signal
()
adaptor
=
SymmetricTwoportAdaptor
(
0.5
,
in1
,
signal
)
out1
=
Output
(
adaptor
.
output
(
0
))
out2
=
Output
(
adaptor
.
output
(
1
))
with
pytest
.
raises
(
ValueError
,
match
=
"
Dangling signal without source in SFG
"
):
SFG
([
in1
],
[
out1
,
out2
])
def
test_remove_signal_with_different_number_of_inputs_and_outputs
(
self
):
in1
=
Input
()
in2
=
Input
()
add1
=
Addition
(
in1
,
in2
,
name
=
"
addition
"
)
out1
=
Output
(
add1
)
sfg
=
SFG
([
in1
,
in2
],
[
out1
])
# Try to remove non-existent operation
sfg1
=
sfg
.
remove_operation
(
"
foo
"
)
assert
sfg1
is
None
with
pytest
.
raises
(
ValueError
,
match
=
(
"
Different number of input and output ports of operation with
"
),
):
sfg
.
remove_operation
(
'
add1
'
)
def
test_inputs_required_for_output
(
self
):
in1
=
Input
()
in2
=
Input
()
add1
=
Addition
(
in1
,
in2
,
name
=
"
addition
"
)
out1
=
Output
(
add1
)
sfg
=
SFG
([
in1
,
in2
],
[
out1
])
with
pytest
.
raises
(
IndexError
,
match
=
re
.
escape
(
"
Output index out of range (expected 0-0, got 1)
"
),
):
sfg
.
inputs_required_for_output
(
1
)
Loading