Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for parsing and code gen stages #356

Closed
chrispcampbell opened this issue Sep 14, 2023 · 0 comments · Fixed by #381
Closed

Add unit tests for parsing and code gen stages #356

chrispcampbell opened this issue Sep 14, 2023 · 0 comments · Fixed by #381

Comments

@chrispcampbell
Copy link
Contributor

The compiler already has pretty good integration test coverage, but is lacking in unit tests. It would make refactoring easier if we had more granular unit tests for the different stages, such as parsing (for subscripts, variables, equations) and code generation.

I'm currently working on adding unit tests for each of these stages. The initial plan is to write unit tests that utilize the existing sample models (from the models directory). This way we will get similar coverage as in the integration tests, except these unit tests target a specific phase, so it will make it easier to pinpoint issues when I get around to refactoring these layers.

I won't be making any changes to the implementation of the compiler at this stage, only adding tests. These will essentially be snapshot tests that capture the output of the current compiler implementation. Later, when I get a chance to refactor the different phases (goal is to make the parsing code less Vensim specific), the goal is to have the new code produce exactly the same results as the existing code, so the snapshot approach will be helpful here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant