Skip to content

Commit

Permalink
missing parameter test
Browse files Browse the repository at this point in the history
  • Loading branch information
UnsignedByte committed Apr 15, 2024
1 parent a380dfb commit 69615c7
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/gen/shift.fil
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import "primitives/state.fil";
/// A simple shift register component that delays a signal by D cycles.
comp main[W, D]<'G: 1>(
in: ['G, 'G+1] W
) -> (
out: ['G+D, 'G+D+1] W
) where W > 0 {
shift := new Shift[W, D]<'G>(in);
out = shift.out{0};
}
11 changes: 11 additions & 0 deletions tests/gen/shift/5.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"interfaces": [
{"name": "null", "event": "G", "delay": 1, "states": 6, "phantom": true }
],
"inputs": [
{ "event": "G", "name": "in", "width": 32 , "start": 0, "end": 1 }
],
"outputs": [
{ "event": "G", "name": "out", "width": 32 , "start": 5, "end": 6 }
]
}
1 change: 1 addition & 0 deletions tests/gen/shift/5.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
params = [32, 5]
11 changes: 11 additions & 0 deletions tests/gen/shift/6.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"interfaces": [
{"name": "null", "event": "G", "delay": 1, "states": 7, "phantom": true }
],
"inputs": [
{ "event": "G", "name": "in", "width": 32 , "start": 0, "end": 1 }
],
"outputs": [
{ "event": "G", "name": "out", "width": 32 , "start": 6, "end": 7 }
]
}
1 change: 1 addition & 0 deletions tests/gen/shift/6.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
params = [32, 6]
11 changes: 11 additions & 0 deletions tests/gen/shift/missing.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---CODE---
1
---STDERR---
error: `main' requires at least 2 parameters but 1 were provided
┌─ tests/gen/shift.fil:3:6
3 │ comp main[W, D]<'G: 1>(
│ ^^^^ `main' requires at least 2 parameters but 1 were provided

Compilation failed with 1 errors.
Run with --show-models to generate assignments for failing constraints.
2 changes: 2 additions & 0 deletions tests/gen/shift/missing.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Missing the D parameter
params = [32]

0 comments on commit 69615c7

Please sign in to comment.