ldtteam / Aequivaleo

Analysis engine and mediator mod for analyzing recipes and equivalencies of items, blockstates and other game objects in minecraft.
GNU General Public License v3.0
5 stars 4 forks source link

Testability of the analyzer #2

Closed MaPePeR closed 4 years ago

MaPePeR commented 4 years ago

I wanted to play around with the analyzer algorithm and maybe write some tests to see how it works, but I found it very hard (=impossible for me) to run it in isolation.

I could replace the World-Object with a RegistryKey<World>-Object, which was easier to create in a Test, but ran into other issues then, that indicated I somehow need to initialize forge, which is outside of my comfort zone right now, as I'm a bit rusty in Minecraft programming.

I think it would be a little easier if the JGraphTBasedCompoundAnalyzer was instantiated with instances of ILockedCompoundInformationRegistry, etc. instead of requesting them on demand. That would also save a lot of getInstance-Calls.

I think having junit tests makes it a lot easier and robust to develop an algorithm like this, as you can just keep coming up with new test setups and confirm the old tests still work as expected.

marchermans commented 4 years ago

This will be added when the refactorings branch is merged.