Adding tests is really hard
kevinramharak opened this issue · comments
Hey Simon,
I was trying to add tests for each instruction because i am not confident they all work 100% correctly, but it is really hard to add tests for some instructions. For example the CallInstruction
expects a CPU instance
and the CPU
instance either uses the GameServer
singleton (which does not exist in tests) or you can give it a fake config, but then you need to give it a Cubot
instance.
The more complicated the instruction becomes the hard it is to test. I know you have some refactoring in mind. Any ideas on how to make testing easier to implement?
Any ideas on how to make testing easier to implement?
It's definitely planned to add Fakes for Cubot & CPU etc. Even better would be to abstract all the Assembler/CPU code to allow for different ISAs. I'll keep you updated on my progress
I added some helper functions, let me know what you think.
Example:
That seems way easier. Expressing the assembly in java is hard. This would make it trivial