mmikaitis / anymatrix

A MATLAB matrix collection with an interface to organize matrices
BSD 2-Clause "Simplified" License
24 stars 4 forks source link

Property based testing #1

Open tommschowar opened 2 years ago

tommschowar commented 2 years ago

(Skip to Questions if you are not interested why I opened this issue) I am the author of the unit test framework TTEST for matlab/octave which features a limited form of property based testing. Property based tests check whether a function abides by some properties, e.g. is idempotent. For that it needs to generate a wide range of different inputs, e.g. matrices.

I already have a generator for matrices, but it is far from good yet. Especially it is hard to specify which properties the output matrices shall have. Currently, my generators only can generate matrices with a random set of properties. So I wonder whether it is possible to use anymatrix to generate random matrices with pre-defined properties.

Questions

mmikaitis commented 2 years ago

Hi. Many thanks for your questions.

First question: I think this is already possible with Anymatrix by first randomly picking properties, then searching by those properties, and then generating the returned matrices with random parameters. This use case is probably too specialized to justify a separate command in the Anymatrix interface, and it should be implemented externally using the existent commands.

Second question: We will consider pull requests with any useful improvements or bug fixes to anymatrix.

Third question: It most likely can be done, but there would need to be a big user group that needs Anymatrix in Octave. Many of the internal things we used, such as pattern matching and extracting functionalities recently introduced in MATLAB, would probably need to be changed when working with Octave.

-- Mantas