We are porting (a subset of) rustreexo to Cairo and we also need to adopt their testing suite to ensure correctness.
Task
Generate a Cairo file with unit test stubs so that each stub contains test case data (initial roots, leaves to be added/deleted, proofs, expected roots). We will add the actual execution later.
Step 1: pre-process files from https://github.com/mit-dci/rustreexo/tree/main/test_values by converting them to a flat list of identical test cases (removing unnecessary info like cached nodes and adding missing data like expected roots).
Step 2: code generate Cairo unit tests using the processed data.
You'll end up having two Python scripts that do the job.
Context
We are porting (a subset of) rustreexo to Cairo and we also need to adopt their testing suite to ensure correctness.
Task
Generate a Cairo file with unit test stubs so that each stub contains test case data (initial roots, leaves to be added/deleted, proofs, expected roots). We will add the actual execution later.
Step 1: pre-process files from https://github.com/mit-dci/rustreexo/tree/main/test_values by converting them to a flat list of identical test cases (removing unnecessary info like cached nodes and adding missing data like expected roots).
Step 2: code generate Cairo unit tests using the processed data.
You'll end up having two Python scripts that do the job.
Implementation notes
Expected processed file format:
Expected Cairo unit test:
Note that depending on the test type some data might be omitted.
Test data pre-processing:
Write files to the following locations (one for each test type):
packages/utreexo/tests/data/*.json
packages/utreexo/tests/*.cairo
Place definitions of
UtreexoTestCase
andUtreexoTestType
topackages/utreexo/tests/lib.cairo