servo / uluru

A simple, fast, LRU cache implementation.
Mozilla Public License 2.0
191 stars 20 forks source link

Use QuickCheck for test #13

Closed CYBAI closed 3 years ago

CYBAI commented 4 years ago

Current test cases are great enough though, I wonder if it's good to introduce quickcheck to have more randomness in the test cases.

Also, I added tests for front, find and touch in this PR.

(btw, I just noticed there's no CI for this repo 👀 maybe it's good to use GitHub Actions or Travis CI?)

jdm commented 4 years ago

Yes, adding CI to this repo would be nice.

mbrubeck commented 3 years ago

Thanks, this is very useful!

I'm not sure that every test needs to be a quickcheck test, though. For example, the new evict_all test doesn't really add any new coverage compared to the old one, since it only randomizes the stored values, which has no effect on the uluru code being tested.

For simplicity, could you keep the existing non-quickcheck tests, and use quickcheck only in new tests that benefit from the randomization?

CYBAI commented 3 years ago

Thanks, this is very useful!

I'm not sure that every test needs to be a quickcheck test, though. For example, the new evict_all test doesn't really add any new coverage compared to the old one, since it only randomizes the stored values, which has no effect on the uluru code being tested.

For simplicity, could you keep the existing non-quickcheck tests, and use quickcheck only in new tests that benefit from the randomization?

Indeed, that makes sense to me. I will update the PR to only use quickcheck for new tests! Thanks!