-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Description
Right now, we just assume that the decoding and encoding functions generated by Daedalus work (which they do, as far as we know...)
It would be really nice to leave the hypothetical world and have some unit tests that validate this hypothesis
Acceptance Criteria
Set up a testing framework that is able to test the code generated by Daedalus by running cargo test
Optionally, something that uses trybuild (see below) to test that the macro expansion compiles properly (this is otherwise a very arcane process)
Proposed Solution
Set up a mod tests in libs/daedalus/, testing the sub-functions that the macro calls. If you look into the architecture of gen_decode_data! and gen_encode_data!, you'll see that it's broken up into granular sub-functions (that are defined in libs/calypso-cangen/. It would be more realistic to test that these work as expected, rather than expanding and re-expanding the macro for every test. Maybe one or two tests that expand the macros and test that things work as expected, but otherwise, it would be better for the planet to not do that.
Here are some resources that may help: