2 ms·
The original claim for TDD is your write tests for all your edge cases. It doesn't matter about inputs you didn't consider because they are covered in the edge
by bluGill 11mo ago
The original claim for TDD is your write tests for all your edge cases. It doesn't matter about inputs you didn't consider because they are covered in the edge. If you can only accept inputs from 2-7 (inclusive) you check 1,2,7,8 - if those pass you assume the rest work.
- Cpoll 11mo agoYou forgot 0, -1, null, "1".
- bluGill 11mo agoSince I work in a strongly typed languages the last two will fail to compile and are thus not worth the bother - those who don't have that luxury of course need to test the edge cases that apply to them. The first are maybe, in my experience they are rarely a problem, but we need to go from the abstract to the particular algorithm before we can have a discussion on if they are potentially a problem or not.
- OptionOfT 11mo agoIf you're using Rust you can push it one level further: use a NonZeroU*. More than that and you'll need nightly for now: https://docs.rs/ranged_integers/latest/ranged_integers/ https://docs.rs/ranged_integers/latest/ranged_integers/