/*
 * Copyright 2011-2013, by Vladimir Kostyukov and Contributors.
 * 
 * This file is part of la4j project (http://la4j.org)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * Contributor(s): -
 * 
 */

package org.la4j.matrix.dense;

import java.util.Arrays;

import org.la4j.matrix.AbstractMatrixTest;

public abstract class DenseMatrixTest extends AbstractMatrixTest {

    public void testToArray() {
        double array[][] = new double[][] { 
                { 1.0, 0.0, 0.0 },
                { 0.0, 5.0, 0.0 }, 
                { 0.0, 0.0, 9.0 } 
        };

        DenseMatrix a = (DenseMatrix) factory().createMatrix(array);

        double[][] toArray = a.toArray();

        for (int i = 0; i < a.rows(); i++) {
            assertTrue(Arrays.equals(array[i], toArray[i]));
        }
    }
    
	public void testRotation() {
		double array[][] = new double[][] { 
				{ 1.0, 2.0 }, 
				{ 3.0, 4.0 } 
		};
		Basic2DMatrix m = new Basic2DMatrix(array);
		Basic2DMatrix n = (Basic2DMatrix) m.rotate();
		assertTrue(n.get(0, 0) == 3.0);
		assertTrue(n.get(0, 1) == 1.0);
		assertTrue(n.get(1, 0) == 4.0);
		assertTrue(n.get(1, 1) == 2.0);
	}

}

@@ -1431,16 +1431,101 @@
 %7D %0A%09%09%7D;%0A
+%09%09%0A%09%09double array2%5B%5D%5B%5D = new double%5B%5D%5B%5D %7B %0A%09%09%09%09%7B 3.0, 1.0 %7D, %0A%09%09%09%09%7B 4.0, 2.0 %7D %0A%09%09%7D;%0A
 %09%09Basic2
@@ -1533,16 +1533,17 @@
 Matrix m
+1
  = new B
@@ -1579,17 +1579,18 @@
 DMatrix 
-n
+m2
  = (Basi
@@ -1601,16 +1601,17 @@
 atrix) m
+1
 .rotate(
@@ -1619,74 +1619,57 @@
 ;%0A%09%09
+B
 as
-sertTrue(n.get(0, 0) == 3.0);%0A%09%09assertTrue(n.get(0, 1) == 1.0
+ic2DMatrix m3 = new Basic2DMatrix(array2
 );%0A
+%09%09%0A
 %09%09as
@@ -1681,62 +1681,26 @@
 rue(
-n.get(1, 0) == 4.0);%0A%09%09assertTrue(n.get(1, 1) == 2.0);
+m2.equals(m3));%0A%09%09
 %0A%09%7D%0A

Use Matrix.equal() and predefined correct matrix for testing on correctness