Reputation: 35796
I have a method that takes an array as an argument, and returns true or false depending on the presence of a particular value.
In this scenario how many test cases should be written?
I think 3:
Upvotes: 1
Views: 110
Reputation: 24151
It is the code of the function you want to test, so you cannot tell how many test cases are useful. Think again what your code does, how will the value be found?
An example: If your code tries to find a value with a certain name, and you make a string comparison, then think of the problems that can arise with string comparisons -> should the key be found case (in)sensitive, is null equal to an empty string, how does it handle duplicates and are other types converted correctly to strings (type juggling)?
Upvotes: 0
Reputation: 2476
I can think of 3 test cases:
Upvotes: 2