-
-
Notifications
You must be signed in to change notification settings - Fork 60
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 ModLibrary
#846
Comments
Hello @lethal-guitar, Thank you! |
Hey @naftalimurgor, sure thing! So this is about the class RigelEngine/src/data/mod_library.hpp Line 50 in 2dc22c5
More specifically, the member function Further complicating things is the data layout, which is optimized for fast reordering. Instead of storing mod path and enabled state together in a single list, these are split across two lists, with one list containing all the mod paths, and the other list pointing into the first one via indices. Ok, and now because all of this logic is a bit tricky, it would be nice to have some unit tests for the different cases, like dir list unchanged, mods added only, mods removed only, and mods added and removed at the same time. Ideally, these unit tests would stub out or mock the part of the code that queries the actual filesystem, and instead allow injecting a fake list of directories for testing. How exactly to do that would be part of this work, as there are various options. I haven't thought too much about this yet, but I could imagine passing in a EDIT: Also see https://github.com/lethal-guitar/RigelEngine/wiki/Modding-support#mods-directory for further context. |
Ah, I forgot to mention, you can find existing unit tests here: https://github.com/lethal-guitar/RigelEngine/tree/master/test So for this issue here, I would suggest adding a new file called The testing framework used is https://github.com/catchorg/Catch2 |
@lethal-guitar |
Great, sounds good! Let me know if you have any questions. |
I'm actually looking into trying to make some part of rescan a free function, would make it much easier to test its output (as now it's just a void function) - we can then use the free function inside the mod library class My initial effort (#919) was trying to stub out the filesystem, sadly, even if it was a fun experiment, it's probably far from enough EDIT: actually maybe I can use the getters to check the result of rescan, TBD |
No description provided.
The text was updated successfully, but these errors were encountered: