kotlin-coding-challenges
kotlin-coding-challenges copied to clipboard
fixes for AdvancedLRU with naive implementtion, LRUCache, and AnyCallback
Here are some changes that fix some of the issues in these 3 tests:
- AdvancedLRU (see #142)
- LRUCache
- AnyCallback (see #143)
Note, it should be easy to change tests to work with known solutions or the challenge solution. So one idea of that is here, basically having a "class under test" or a "function under test" although parameterized tests can be used, they would cause noise when working on the project. There are probably ways to use dynamic tests or other test providers to make this work for all solutions at the same time, without being noisy to the person solving a problem.
Also tried a few other ideas here:
- clock for AdvancedLRU
- generics for all collections
- test data that is less confusing (int, int, long) are hard to remember what is what
and fixed AdvancedLRU solution problems. Note that there are problems with this question making it complex to implement both expiry and priority/lastAccess removal that were not addressed at all in the original solution. The updated solution is klunky and naive but shows the fixes required to make both work correctly at the same time. (see #142)
Another option for solutions and tests, are to have branches with the questions solved using the same tests and function/class. But that works less well when there are multiple solutions to showcase. Not sure why solutions are private (makes them hard to test and verify)
Not sure which ideas you want from here, but this shows a bit more of some of the issues present here.