Unit test for const generic function

I currently have a function which takes in an array with a const generic for the length. This itself is not too abnormal. I would like to implement unit tests for the function, however I am faced with the fact that I am unable to provide an arrays of random length to the test function, which limits the scope of what I can test easily.

I understand that having an array of dynamic size means rust would be unable to determine the size of the array. So the question being, is there a way to implement unit tests for this function without manually typing out each array size I would want to test.

If you can implement const random :rofl: (it can be done using proc macros). Otherwise you will need to use vectors.

You could use a build script to randomly generate a bunch of tests.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.