google/xls

[enhancement] Support test utility methods

Opened this issue · 0 comments

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

Let me write a test helper method that does not get lowered to SV, e.g.,

#[cfg(test)]
fn assert_value_is_0<N: u32>(a: uN[N]) {
  assert_eq(0, a);
}

#[test]
fn test_zeros() {
  assert_value_is_0(u1:0);
  assert_value_is_0(u2:0);
}

Current best alternative workaround (limit 100 words)

The helper code needs to be in-line in the #[test] method. It can be repetitive.

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

A new annotation #[cfg(test)] (which is what Rust has, evidently) could be used to tag functions that are test-support but not run as part of a test suite.