import junit.framework.TestCase;

public class ReverseTester extends TestCase {
    
    private int[] b;
    
    public void testEmpty() {
        b= new int[0];
        L8.reverse(b);        
    }
    
    public void testOneElement() {
        b= new int[1];
        b[0]= 3;  
        // Why set the single element to 3?  Why not leave it as default value (zero)?
        // Because this way we can see if method reverse accidentally reinitializes the contents of b.
        
        L8.reverse(b);  // Correction: This line was missing in lecture.
        
        assertTrue(b[0] == 3);
    }
    
    public void testEvenNumberElements() {
        b = new int[] {29, 37};
        L8.reverse(b);
        assertTrue(b[0] == 37 && b[1] == 29);
    }
    
    public void testOddNumberElements() {
        b = new int[] {29, 37, 16};
        L8.reverse(b);
        assertTrue(b[0] == 16 && b[1] == 37 && b[2] == 29);
    }
    
    public void testManyElements(){
        // instantiate the array
        b = new int[1000];
        
        // initialize the elements of the array to 1..b.length
        for(int i= 0; i< b.length; i++) {
            b[i] = i+1;
        }
        
        L8.reverse(b);
        
        // assert that the elements of the array have been correctly reversed
        for(int i= 0; i< b.length; i++) {
            assertTrue(b[i] == b.length - i);
        }
    }
    
}


