ZoKrates
ZoKrates copied to clipboard
Make testing framework less verbose
With this PR (https://github.com/Zokrates/ZoKrates/pull/279) being merged we use integration tests for the stdlib code.
The existing json based approach to define these tests has some room for improvements:
- Tests are now separated into two files. Most of the logic will stay in the
.code
file, but the.json
test framework description is still needed to execute them. Several test don’t even need inputs or outputs, hence the json just wraps the test. - in general the syntax is more verbose (no support for types,..), especially for arrays.
- the lack of being able to add context via comments for the input / output field in json does not help here
The main benefit we gain from using integration tests is that we can test for exceptions.
Ideally we could flag tests via an annotation in the .code
that the corresponding test should panic.
In order to make this work with the existing test runner we would need to be able to call individual functions defined in a .code
file (not just the main).