import junit.framework.TestCase;
import junit.framework.Assert;

/**
 * A JUnit test case class.
 * Every method starting with the word "test" will be called when running
 * the test with JUnit.
 */
public class MatriceLibTest extends TestCase {
  
  /**
   * Goal: verifies a rotation for a minimal matrix
   */
  public void testRotation1() {
    int[][] mat = {{1}};    // Givens
    int[][] expected = {{1}}; // expected result
    
    int[][] res = MatriceLib.rotation(mat); // returned result
    
    // Verification
    boolean verdict = MatriceLib.compare(res, expected);
    Assert.assertTrue(verdict);
  }

  /**
   * Goal: verifies a rotation for a bigger square matrix
   */
  public void testRotation2() {
    int[][] mat = {{00, 01, 02}, 
                   {10, 11, 12}, 
                   {20, 21, 22}}; // GIVENS

    int[][] expected = {{20, 10, 00},
                       {21, 11, 01}, 
                       {22, 12, 02}}; //expected result
    
    int[][] res = MatriceLib.rotation(mat); //returned result
    
    // Verification
    boolean verdict = MatriceLib.compare(res, expected);
    Assert.assertTrue(verdict);
  }
  
  /**
   * Goal: verifies 4 rotations for a square matrix
   */
  public void testRotation3() {
    int[][] mat = {{00, 01, 02}, 
                   {10, 11, 12}, 
                   {20, 21, 22}}; // GIVENS and expected result
    
    int[][] res1 = MatriceLib.rotation(mat);  // partial result
    int[][] res2 = MatriceLib.rotation(res1); // partial result
    int[][] res3 = MatriceLib.rotation(res2); // partial results
    int[][] res4 = MatriceLib.rotation(res3); // returned result
    
    // Vérification
    boolean verdict = MatriceLib.compare(res4, mat);
    Assert.assertTrue(verdict);
  }
}
