Testing Edge Cases
It is also important to test extremely atypical cases. What happens when things are towards the end of your array,
or when you have very large numbers? Will your program continue to function with
empty inputs? In the case of the SearchArray constructor, the edge condition we may want to
test would be the case when the array elements lie exactly on the range. The
following section inside the main
method tests this edge case.
//test case to check edge values of the constructor System.out.println("Edge case for constructor. Array values " + "exactly on range limits"); int[] testArray3={-5,-9,0,-1,3,6,7,-2,2}; s=new SearchArray(testArray3,-9,7); }
Objective 4 for this lab
Write one or more than one edge test cases for the search method. Note that edge cases are usually atypical scenarios or inputs which might only be encountered occassionally.