This project implements property-based randomized testing for the Tact language's expression pretty-printer. The goal is to ensure the correctness of the pretty-printer by verifying that the process of pretty-printing and parsing Tact expressions is consistent.
- The tests are written using the
fast-checklibrary for property-based testing. - Random ASTs are generated for expressions.
- The
prettyPrintfunction converts the AST into a string representation. - The
parseExpressionfunction parses the string back into an AST. - The original and parsed ASTs are compared for equivalence.
If the ASTs are not equivalent, it indicates a bug in the pretty-printer or parser.
- Custom AST comparison: Implements an equality function to compare ASTs while ignoring metadata like
locandid. - Optional shrinking: Helps minimize counter-examples for easier debugging (bonus feature).
Clone this repository into your project.
Add the necessary imports to your project's imports file to integrate the testing functionality.
Install the required dependency using npm or yarn:
npm install fast-checkRun the tests using your preferred test runner (e.g., Jest).