This python 3 package makes it easy for you to write PSM(4) Assembly - even **test-first**!
Simply write a unit test for it in python, extending from `OpbTestCase`. It's easily integratable into your CI environment by leveraging the output of `python -m unittest`.
That's it! Load your Assembly file, apply setup (mocks, inputs), and verify expectations.
opbtest relies on [opbasm and opbsim](https://kevinpt.github.io/opbasm) to compile and evaluate your code.
Both executables should be in your `$PATH`.
The simulator will behave different compared to the actual hardware, so be aware that a set of green tests will not guarantee your code to work when deployed.
Only testing proc1, and nothing more, is usually tricky in Assembly because of the jump statement. opbtest will inject code into your Assembly to jump to the procedure to test, execute that, and jump to an exit label. That ensures no other state will be modified.
#### Mocking
If you explicitly do **not** want a certain procedure to be called, you can do so by calling `mockproc(procname)`.
This will replace all `call procname` statements with dummy statements, hence never actually executing the procedure.
You can replace your own statements with `replace(statement_to_replace, statement_to_replace_with)`.