University of Texas at El Paso
Banner
Compuer Science
   
TestBinarySearch.java Minimize    

import junit.framework.TestCase;
public class TestBinarySearch extends TestCase{
  public void test1(){
    int[] testList = {2,4,7,10,11,45,50,59,60,66,69,70,79};
    int expected = 4;
    int actual = BinarySearch.binarySearch(testList,11);
    assertEquals("searching 4", expected, actual);
  }
  public void test2(){
    int[] testList = {2,4,7,10,11,45,50,59,60,66,69,70,79};
    int expected = 0;
    int actual = BinarySearch.binarySearch(testList,2);
    assertEquals("searching 2", expected, actual);
  }
  public void test3(){
    int[] testList = {2,4,7,10,11,45,50,59,60,66,69,70,79};
    int expected = 12;
    int actual = BinarySearch.binarySearch(testList,79);
    assertEquals("searching 79", expected, actual);
  }
  public void test4(){
    int[] testList = {2,4,7,10,11,45,50,59,60,66,69,70,79};
    int expected = 6;
    int actual = BinarySearch.binarySearch(testList,50);
    assertEquals("searching 50", expected, actual);
  }
}