sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1522517 - in /sis/branches/JDK7: ./ core/sis-referencing/ core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/ core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/ core/sis-referencing/src/tes...
Date Thu, 12 Sep 2013 10:40:35 GMT
Author: desruisseaux
Date: Thu Sep 12 10:40:34 2013
New Revision: 1522517

URL: http://svn.apache.org/r1522517
Log:
Initial draft of test classes.

Added:
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix1Test.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix2Test.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix4Test.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
  (with props)
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrixTest.java
  (with props)
Modified:
    sis/branches/JDK7/core/sis-referencing/pom.xml
    sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java
    sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
    sis/branches/JDK7/pom.xml

Modified: sis/branches/JDK7/core/sis-referencing/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/pom.xml?rev=1522517&r1=1522516&r2=1522517&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/pom.xml (original)
+++ sis/branches/JDK7/core/sis-referencing/pom.xml Thu Sep 12 10:40:34 2013
@@ -132,6 +132,11 @@ Implementations of Coordinate Reference 
       <artifactId>geoapi-conformance</artifactId>
     </dependency>
     <dependency>
+      <groupId>gov.nist.math</groupId>
+      <artifactId>jama</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.apache.sis.core</groupId>
       <artifactId>sis-utility</artifactId>
       <version>${project.version}</version>

Modified: sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java?rev=1522517&r1=1522516&r2=1522517&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java
[UTF-8] Thu Sep 12 10:40:34 2013
@@ -67,7 +67,8 @@ class GeneralMatrix extends MatrixSIS {
         this.numCol = (short) numCol;
         elements = new double[numRow * numCol];
         if (setToIdentity) {
-            for (int i=0; i<elements.length; i += numCol+1) {
+            final int stop = Math.min(numRow, numCol) * numCol;
+            for (int i=0; i<stop; i += numCol+1) {
                 elements[i] = 1;
             }
         }

Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java?rev=1522517&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java
[UTF-8] Thu Sep 12 10:40:34 2013
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.sis.referencing.operation.matrix;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link GeneralMatrix} implementation with square matrices.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class GeneralMatrixTest extends MatrixTestCase {
+    /**
+     * Number of rows and columns, initialized by {@link #initialize(String, boolean)}.
+     */
+    private int size;
+
+    /** {@inheritDoc} */ @Override int getNumRow() {return size;}
+    /** {@inheritDoc} */ @Override int getNumCol() {return size;}
+
+    /**
+     * Chooses a random size for the square matrix.
+     *
+     * @param testMethod  The name of the method which need a random number generator.
+     * @param needsRandom Ignored.
+     */
+    @Override
+    void initialize(final String testMethod, final boolean needsRandom) {
+        super.initialize(testMethod, true);
+        size = 5 + random.nextInt(8); // Matrix sizes from 5 to 12 inclusive.
+    }
+
+    /**
+     * Ensures that the given matrix is an instance of the expected type.
+     */
+    @Override
+    void validate(final MatrixSIS matrix) {
+        super.validate(matrix);
+        assertEquals(GeneralMatrix.class, matrix.getClass());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/GeneralMatrixTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix1Test.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix1Test.java?rev=1522517&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix1Test.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix1Test.java
[UTF-8] Thu Sep 12 10:40:34 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.sis.referencing.operation.matrix;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link Matrix1} implementation.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class Matrix1Test extends MatrixTestCase {
+    /** {@inheritDoc} */ @Override int getNumRow() {return 1;}
+    /** {@inheritDoc} */ @Override int getNumCol() {return 1;}
+
+    /**
+     * Ensures that the given matrix is an instance of the expected type.
+     */
+    @Override
+    void validate(final MatrixSIS matrix) {
+        super.validate(matrix);
+        assertEquals(Matrix1.class, matrix.getClass());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix1Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix1Test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix2Test.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix2Test.java?rev=1522517&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix2Test.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix2Test.java
[UTF-8] Thu Sep 12 10:40:34 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.sis.referencing.operation.matrix;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link Matrix2} implementation.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class Matrix2Test extends MatrixTestCase {
+    /** {@inheritDoc} */ @Override int getNumRow() {return 2;}
+    /** {@inheritDoc} */ @Override int getNumCol() {return 2;}
+
+    /**
+     * Ensures that the given matrix is an instance of the expected type.
+     */
+    @Override
+    void validate(final MatrixSIS matrix) {
+        super.validate(matrix);
+        assertEquals(Matrix2.class, matrix.getClass());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix2Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix2Test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java?rev=1522517&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java
[UTF-8] Thu Sep 12 10:40:34 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.sis.referencing.operation.matrix;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link Matrix3} implementation.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class Matrix3Test extends MatrixTestCase {
+    /** {@inheritDoc} */ @Override int getNumRow() {return 3;}
+    /** {@inheritDoc} */ @Override int getNumCol() {return 3;}
+
+    /**
+     * Ensures that the given matrix is an instance of the expected type.
+     */
+    @Override
+    void validate(final MatrixSIS matrix) {
+        super.validate(matrix);
+        assertEquals(Matrix3.class, matrix.getClass());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix3Test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix4Test.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix4Test.java?rev=1522517&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix4Test.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix4Test.java
[UTF-8] Thu Sep 12 10:40:34 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.sis.referencing.operation.matrix;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link Matrix4} implementation.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class Matrix4Test extends MatrixTestCase {
+    /** {@inheritDoc} */ @Override int getNumRow() {return 4;}
+    /** {@inheritDoc} */ @Override int getNumCol() {return 4;}
+
+    /**
+     * Ensures that the given matrix is an instance of the expected type.
+     */
+    @Override
+    void validate(final MatrixSIS matrix) {
+        super.validate(matrix);
+        assertEquals(Matrix4.class, matrix.getClass());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix4Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/Matrix4Test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java?rev=1522517&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
[UTF-8] Thu Sep 12 10:40:34 2013
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.sis.referencing.operation.matrix;
+
+import java.util.Random;
+import Jama.Matrix;
+import org.apache.sis.test.TestCase;
+import org.apache.sis.test.TestUtilities;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Base classes of tests for {@link MatrixSIS} implementations.
+ * This class uses the following {@code Matrices} factory methods:
+ *
+ * <ul>
+ *   <li>{@link Matrices#create(int, int)} (sometime delegates to {@link Matrices#createIdentity(int)})</li>
+ *   <li>{@link Matrices#create(int, int, double[])}</li>
+ *   <li>{@link Matrices#createZero(int, int)}</li>
+ * </ul>
+ *
+ * So this class is indirectly a test of those factory methods.
+ * However this class does not test any other {@code Matrices} methods.
+ *
+ * <p>This class uses <a href="http://math.nist.gov/javanumerics/jama">JAMA</a>
as the reference implementation.</p>
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+public abstract strictfp class MatrixTestCase extends TestCase {
+    /**
+     * Random number generator, created by {@link #initialize(String, boolean)} when first
needed.
+     */
+    Random random;
+
+    /**
+     * For subclasses only.
+     */
+    MatrixTestCase() {
+    }
+
+    /**
+     * Initializes the test. This method shall be invoked at the beginning of each test method.
+     *
+     * @param testMethod The name of the method which need a random number generator.
+     * @param needsRandom {@code true} if the test method will need random numbers.
+     */
+    void initialize(final String testMethod, final boolean needsRandom) {
+        if (needsRandom && random == null) {
+            random = TestUtilities.createRandomNumberGenerator(testMethod);
+        }
+    }
+
+    /** Returns the number of rows of the matrix being tested.    */ abstract int getNumRow();
+    /** Returns the number of columns of the matrix being tested. */ abstract int getNumCol();
+
+    /**
+     * Validates the given matrix.
+     * The default implementation verifies only the matrix size. Subclasses should override
this method
+     * for additional checks, typically ensuring that it is an instance of the expected class.
+     */
+    void validate(final MatrixSIS matrix) {
+        assertEquals("numRow", getNumRow(), matrix.getNumRow());
+        assertEquals("numCol", getNumCol(), matrix.getNumCol());
+    }
+
+    /**
+     * Tests {@link MatrixSIS#isIdentity()}. This method will first invoke {@link Matrices#create(int,
int)}
+     * and ensure that the result contains 1 on the diagonal and 0 elsewhere.
+     */
+    @Test
+    public void testIsIdentity() {
+        initialize("testIsIdentity", false);
+        final int numRow = getNumRow();
+        final int numCol = getNumCol();
+        final MatrixSIS matrix = Matrices.create(numRow, numCol);
+        validate(matrix);
+        assertEquals("isIdentity", numRow == numCol, matrix.isIdentity());
+        for (int j=0; j<numRow; j++) {
+            for (int i=0; i<numCol; i++) {
+                final double element = matrix.getElement(j,i);
+                assertEquals((i == j) ? 1 : 0, element, 0);
+                matrix.setElement(j, i, 2);
+                assertFalse("isIdentity", matrix.isIdentity());
+                matrix.setElement(j, i, element);
+            }
+        }
+        assertEquals("isIdentity", numRow == numCol, matrix.isIdentity());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/MatrixTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Added: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrixTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrixTest.java?rev=1522517&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrixTest.java
(added)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrixTest.java
[UTF-8] Thu Sep 12 10:40:34 2013
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.sis.referencing.operation.matrix;
+
+import org.apache.sis.test.DependsOn;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Tests the {@link NonSquareMatrix} implementation.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+@DependsOn(GeneralMatrixTest.class)
+public final strictfp class NonSquareMatrixTest extends MatrixTestCase {
+    /**
+     * Number of rows and columns, initialized by {@link #initialize(String, boolean)}.
+     */
+    private int numRow, numCol;
+
+    /** {@inheritDoc} */ @Override int getNumRow() {return numRow;}
+    /** {@inheritDoc} */ @Override int getNumCol() {return numCol;}
+
+    /**
+     * Chooses a random size for the matrix and ensure that the matrix is not square.
+     *
+     * @param testMethod  The name of the method which need a random number generator.
+     * @param needsRandom Ignored.
+     */
+    @Override
+    void initialize(final String testMethod, final boolean needsRandom) {
+        super.initialize(testMethod, true);
+        numRow = 5 + random.nextInt(8); // Matrix sizes from 5 to 12 inclusive.
+        do numCol = 5 + random.nextInt(8);
+        while (numCol == numRow);
+    }
+
+    /**
+     * Ensures that the given matrix is an instance of the expected type.
+     */
+    @Override
+    void validate(final MatrixSIS matrix) {
+        super.validate(matrix);
+        assertEquals(NonSquareMatrix.class, matrix.getClass());
+    }
+}

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrixTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/matrix/NonSquareMatrixTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1522517&r1=1522516&r2=1522517&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
[UTF-8] Thu Sep 12 10:40:34 2013
@@ -30,12 +30,21 @@ import org.junit.BeforeClass;
  * @module
  */
 @Suite.SuiteClasses({
+    // Test matrix first because they may be used in about every SIS corners.
+    org.apache.sis.referencing.operation.matrix.Matrix1Test.class,
+    org.apache.sis.referencing.operation.matrix.Matrix2Test.class,
+    org.apache.sis.referencing.operation.matrix.Matrix3Test.class,
+    org.apache.sis.referencing.operation.matrix.Matrix4Test.class,
+    org.apache.sis.referencing.operation.matrix.GeneralMatrixTest.class,
+    org.apache.sis.referencing.operation.matrix.NonSquareMatrixTest.class,
+
     org.apache.sis.io.wkt.ConventionTest.class,
     org.apache.sis.io.wkt.SymbolsTest.class,
     org.apache.sis.io.wkt.FormatterTest.class,
     org.apache.sis.referencing.NamedIdentifierTest.class,
     org.apache.sis.referencing.AbstractIdentifiedObjectTest.class,
     org.apache.sis.referencing.AbstractReferenceSystemTest.class,
+
     org.apache.sis.geometry.AbstractDirectPositionTest.class,
     org.apache.sis.geometry.GeneralDirectPositionTest.class,
     org.apache.sis.geometry.DirectPosition1DTest.class,

Modified: sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties?rev=1522517&r1=1522516&r2=1522517&view=diff
==============================================================================
--- sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/branches/JDK7/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Thu Sep
12 10:40:34 2013
@@ -71,7 +71,7 @@ test.fra-profile.dir = ${project.root}/p
 geoapi.version       = 3.1-M04
 unit-api.version     = 0.6.1
 jsr275.version       = 0.9.3
-vecmath.version      = 1.5.2
+jama.version         = 1.0.3
 geometry.version     = 1.0
 georss.version       = 0.9.8
 rome.version         = 0.9
@@ -95,7 +95,6 @@ javac.classpath=\
     ${maven.repository}/org/opengis/geoapi-pending/${geoapi.version}/geoapi-pending-${geoapi.version}.jar:\
     ${maven.repository}/org/unitsofmeasurement/unit-api/${unit-api.version}/unit-api-${unit-api.version}.jar:\
     ${maven.repository}/javax/measure/jsr-275/${jsr275.version}/jsr-275-${jsr275.version}.jar:\
-    ${maven.repository}/java3d/vecmath/${vecmath.version}/vecmath-${vecmath.version}.jar:\
     ${maven.repository}/com/esri/geometry/esri-geometry-api/${geometry.version}/esri-geometry-api-${geometry.version}.jar:\
     ${maven.repository}/org/geonames/georss-rome/${georss.version}/georss-rome-${georss.version}.jar:\
     ${maven.repository}/rome/rome/${rome.version}/rome-${rome.version}.jar:\
@@ -109,6 +108,7 @@ javac.test.classpath=\
     ${javac.classpath}:\
     ${maven.repository}/junit/junit/${junit.version}/junit-${junit.version}.jar:\
     ${maven.repository}/org/opengis/geoapi-conformance/${geoapi.version}/geoapi-conformance-${geoapi.version}.jar:\
+    ${maven.repository}/gov/nist/math/jama/${jama.version}/jama-${jama.version}.jar:\
     ${maven.repository}/org/opengis/wrapper/geoapi-netcdf/${geoapi.version}/geoapi-netcdf-${geoapi.version}.jar:\
     ${maven.repository}/org/opengis/wrapper/geoapi-netcdf/${geoapi.version}/geoapi-netcdf-${geoapi.version}-tests.jar:\
     ${build.classes.dir}

Modified: sis/branches/JDK7/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/pom.xml?rev=1522517&r1=1522516&r2=1522517&view=diff
==============================================================================
--- sis/branches/JDK7/pom.xml (original)
+++ sis/branches/JDK7/pom.xml Thu Sep 12 10:40:34 2013
@@ -311,7 +311,7 @@ Apache SIS is a free software, Java lang
   <dependencyManagement>
     <dependencies>
       <!-- Import all dependency management used by the GeAPI project.
-           This include JUnit, vecmath and units of measurement. -->
+           This include JUnit and units of measurement. -->
       <dependency>
         <groupId>org.opengis</groupId>
         <artifactId>geoapi-parent</artifactId>
@@ -338,6 +338,11 @@ Apache SIS is a free software, Java lang
         <version>1.1</version>
       </dependency>
       <dependency>
+        <groupId>gov.nist.math</groupId>
+        <artifactId>jama</artifactId>
+        <version>1.0.3</version>
+      </dependency>
+      <dependency>
         <groupId>javax</groupId>
         <artifactId>javaee-api</artifactId>
         <version>6.0</version>



Mime
View raw message