Add unit tests for utility functions#68
Conversation
Liquidscroll
left a comment
There was a problem hiding this comment.
Looks good to me! All tests passed on WSL2.
However, I think that this should be updated to uncomment the relevant tests, and then ensure this is merged after these functions are fixed. This could occur later, so I'll approve this for now.
hugglesfox
left a comment
There was a problem hiding this comment.
Looks good but it might be nice to tag the tests better. For instance tagging all the string related tests with string, the random related tests with random, time related tests with time, resource tests as resource, etc.
Also want to just mention the idea of splitting each section into a separate file though as all the functions tested are in the same source (iirc) then keeping them all in the one file could make sense.
WhyPenguins
left a comment
There was a problem hiding this comment.
This looks good! Just uncomment those tests and this should be good to merge 😃
|
Ah sorry one more thing, with the latest change to |
|
I uncommented the tests and fixed the |
Description
There are currently no unit tests for the functions listed under 'Utilities' in the SplashKit documentation. I have created exhaustive tests for each of these functions apart from
display_dialogas it is generates purely graphical content and would be better suited forsktests.In the process of creating the tests, I have identified issues with
replace_all,rndandrnd(min, max). I can consistently cause an infinite loop inreplace_all, and an unhanded exception in the two overloads ofrnd. Keeping those tests inskunit_testswill cause it to fail. As a compromise, I have left the tests in place and commented them. My intention is to create separate pull requests to rectify the faulty functions. Once they are fixed, the tests can be uncommented.Type of change
How Has This Been Tested?
Adding the new tests was achieved by running
cmake -G "Unix Makefiles" .followed bymakewhen in the/splashkit-core/projects/cmakedirectory.Testing Checklist
Checklist