Feature request: Generate comprehensive unit tests for generated code...?
Is your feature request related to a problem? Please describe.
In order to detect any regression when translating low level code into high level code, Spice86 is very valuable.
However, more subtle changes in gameplay logic (for example) might get unnoticed (ie. it doesn't crash or generate a graphical or audio glitch, but the Emperor does not ask for the usual amount of Spice by a off-by-one margin, for example)
Describe the solution you'd like
A comprehensive set of unit test. Possibly, auto-generated
Describe alternatives you've considered
Any open-source alternative, including writing our own for our own needs (that is, DUNE).
But there is none at the moment.
Additional context
The DUNE code is a mess, so a good safety net seems appropriate.
Also, IntelliTest is locked behind the very high price of VS Enterprise Edition, is not open-source, only works with the old .NET Framework for Windows, and might be not very valuable in the end. Unless, maybe, if it is guided towards a good solution via attributes :
https://devblogs.microsoft.com/visualstudio/intellitest-for-net-test-more-with-less-effort/
https://learn.microsoft.com/fr-fr/previous-versions/visualstudio/visual-studio-2015/test/generate-unit-tests-for-your-code-with-intellitest?view=vs-2015&redirectedfrom=MSDN
https://devblogs.microsoft.com/devops/intellitest-one-test-to-rule-them-all/
https://devblogs.microsoft.com/devops/smart-unit-tests-test-to-code-binding-test-case-management/
https://www.reddit.com/r/dotnet/comments/3nmq1o/automatically_generate_unit_tests_for_your_code/
It is based on this research project:
https://www.microsoft.com/en-us/research/publication/pex-white-box-test-generation-for-net/
Maybe you could do unit tests based on saved states?
Load a save state, run 1 frame, then create a save state and ensure it matches the expected save state?
Although IDK if your save states are compatible after replacing instructions.
Maybe you could tell the unit test to override certain values in the starting save state (like current instruction address) and similarly ignore or override certain values in the resulting save state.