Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enhancement] Add possibility to parameterize tests #1583

Open
m-torhan opened this issue Sep 4, 2024 · 1 comment
Open

[enhancement] Add possibility to parameterize tests #1583

m-torhan opened this issue Sep 4, 2024 · 1 comment
Labels
dslx DSLX (domain specific language) implementation / front-end enhancement New feature or request testing Test-infrastructure related

Comments

@m-torhan
Copy link

m-torhan commented Sep 4, 2024

What's hard to do? (limit 100 words)

When writing tests it is not possible to create different cases using test parameterization. It would be helpful to be able to write tests that reuse logic and differ in some values.

Current best alternative workaround (limit 100 words)

The user has to use for loop in test proc's next or create multiple test procs.

Your view of the "best case XLS enhancement" (limit 100 words)

The test parameters should be defined using attributes and passed to the test. The test is ran separately using each value.

  1. Similar attributes as in rstest, params are passed to next
#[test_proc]
#[case(u32:0, u32:3, ...)]
#[case(u32:1, u32:4, ...)]
#[case(u32:2, u32:5, ...)]
proc PassthroughTest {
    ...

    next (state: (), param_a: u32, param_b: u32, ...) {
        ...
    }
}
  1. As above, but params are used similarly as in parameterized procs (this would allow spawning parameterized procs using those test params)
#[test_proc]
#[case(u32:0, u32:3, ...)]
#[case(u32:1, u32:4, ...)]
#[case(u32:2, u32:5, ...)]
proc PassthroughTest<PARAM_A: u32, PARAM_B: u32, ...> {
    ...
}
@m-torhan m-torhan added the enhancement New feature or request label Sep 4, 2024
@rw1nkler
Copy link
Contributor

rw1nkler commented Sep 4, 2024

I think that passing random value to test proc proposed in #1528, may be considered as a special case of the parameterized proc.

@proppy proppy changed the title [enhancement] Add possibility to parametrize tests [enhancement] Add possibility to parameterize tests Sep 4, 2024
@proppy proppy added dslx DSLX (domain specific language) implementation / front-end testing Test-infrastructure related labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dslx DSLX (domain specific language) implementation / front-end enhancement New feature or request testing Test-infrastructure related
Projects
Status: No status
Development

No branches or pull requests

3 participants