Skip to content

Commit

Permalink
Use (number | IntervalBounds) for specifying unittests (#2456)
Browse files Browse the repository at this point in the history
* Use (number | IntervalBounds) for specifying unittests

This allows tests that only need a point value to be listed as `1`
instead of `[1]`.

This helps readability, especially for tests where there are arrays of
values, i.e. (number | IntervalBounds)[], since [[1], [2], ...], can
be written as [1, 2, ...]

This require changing the signatures of toVector and toMatrix (and
related functions) to support mixed arrays, i.e. (number |
IntervalBounds)[] instead of number[] | IntervalBuilder[], which
honestly is just more ergonomic, and the code already supported it.

Some tests that were calling the F32Interval constructor directly
have been flipped to using `toInterval`, since they are not testing
the constructor and that is the preferred pattern.

A bunch of documentation lines in the test file have been re-formatted
to be 80 cols, which I think is easier to read, since this PR is all
about readability/ergonomics anyway. I was not super consistent about
line length when writing the tests originally.

Issue #2416
Fixes #2254
  • Loading branch information
zoddicus authored Mar 27, 2023
1 parent 15b8caf commit 7e014d4
Show file tree
Hide file tree
Showing 2 changed files with 2,064 additions and 748 deletions.
Loading

0 comments on commit 7e014d4

Please sign in to comment.