@Test public void testSize() throws Exception { assertEquals(3, testSeq2D.size()); assertEquals(3, testSeq3D.size()); assertEquals(3, testSeq2DM.size()); assertEquals(3, testSeq3DM.size()); assertEquals(0, testEmpty.size()); }
@Test public void testIsMeasured() throws Exception { assertFalse(testSeq2D.isMeasured()); assertFalse(testSeq3D.isMeasured()); assertTrue(testSeq2DM.isMeasured()); assertTrue(testSeq3DM.isMeasured()); assertFalse(testEmpty.isMeasured()); }
@Test public void testGetCoordinates() throws Exception { // test2D double[] result; result = new double[2]; testSeq2D.getCoordinates(result, 0); assertTrue(Arrays.equals(new double[] {0, 0}, result)); testSeq2D.getCoordinates(result, 1); assertTrue(Arrays.equals(new double[] {1, -1}, result)); testSeq2D.getCoordinates(result, 2); assertTrue(Arrays.equals(new double[] {2, -2}, result)); result = new double[3]; testSeq3D.getCoordinates(result, 0); assertTrue(Arrays.equals(new double[] {0, 0, 0}, result)); testSeq3D.getCoordinates(result, 1); assertTrue(Arrays.equals(new double[] {1, -1, 1}, result)); testSeq3D.getCoordinates(result, 2); assertTrue(Arrays.equals(new double[] {2, -2, 2}, result)); testSeq2DM.getCoordinates(result, 0); assertTrue(Arrays.equals(new double[] {0, 0, 0}, result)); testSeq2DM.getCoordinates(result, 1); assertTrue(Arrays.equals(new double[] {1, -1, 1}, result)); testSeq2DM.getCoordinates(result, 2); assertTrue(Arrays.equals(new double[] {2, -2, 2}, result)); result = new double[4]; testSeq3DM.getCoordinates(result, 0); assertTrue(Arrays.equals(new double[] {0, 0, 0, 1}, result)); testSeq3DM.getCoordinates(result, 1); assertTrue(Arrays.equals(new double[] {1, -1, 1, 2}, result)); testSeq3DM.getCoordinates(result, 2); assertTrue(Arrays.equals(new double[] {2, -2, 2, 3}, result)); try { testSeq2D.getCoordinates(result, 3); fail(); } catch (IndexOutOfBoundsException e) { } try { testSeq3D.getCoordinates(result, 3); fail(); } catch (IndexOutOfBoundsException e) { } try { testSeq2DM.getCoordinates(result, 3); fail(); } catch (IndexOutOfBoundsException e) { } try { testSeq3DM.getCoordinates(result, 3); fail(); } catch (IndexOutOfBoundsException e) { } try { testEmpty.getCoordinates(result, 0); fail(); } catch (IndexOutOfBoundsException e) { } result = new double[2]; try { testSeq3D.getCoordinates(result, 1); fail(); } catch (IllegalArgumentException e) { } }