From the course: Debugging in C#

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Covering edge cases

Covering edge cases

From the course: Debugging in C#

Start my 1-month free trial

Covering edge cases

- Just because you're program works for one input, doesn't mean it works for all inputs. That's why developers don't just test the most common type of input, but all types of input. Covering all possible edge cases. Let's take a look at this example. Here, we have some code that returns true or false depending on if the rectangle is a square. Here, we're representing the length and width of the rectangle, with the tuple. Where the length and width are both ints. If we run this code right now, everything works as expected. We have three and three, so our width is three, our length is three. Its true, if we have three and five, so either the width is five, the length is five, the ordering doesn't really matter here. But, if they're not equal, then we get false. You might be thinking that ah, this code is great, it's working. But it's not. What happens if I try to put in zero and zero? In this case, the side or the length or the width, isn't really valid. A rectangle with a zero width…

Contents