@Test public void testGetZ() { assertTrue(Double.isNaN(testSeq2D.getZ(0))); assertTrue(Double.isNaN(testSeq2D.getZ(1))); assertTrue(Double.isNaN(testSeq2D.getZ(2))); assertTrue(Double.isNaN(testSeq2DM.getZ(0))); assertTrue(Double.isNaN(testSeq2DM.getZ(1))); assertTrue(Double.isNaN(testSeq2DM.getZ(2))); assertEquals(0d, testSeq3D.getZ(0), Math.ulp(10d)); assertEquals(1d, testSeq3D.getZ(1), Math.ulp(10d)); assertEquals(2d, testSeq3D.getZ(2), Math.ulp(10d)); assertEquals(0d, testSeq3DM.getZ(0), Math.ulp(10d)); assertEquals(1d, testSeq3DM.getZ(1), Math.ulp(10d)); assertEquals(2d, testSeq3DM.getZ(2), Math.ulp(10d)); try { testSeq3D.getZ(3); fail(); } catch (IndexOutOfBoundsException e) { } }
@Test public void testGetOrdinate() { for (int i = 0; i < 3; i++) { // X Assert.assertEquals( testSeq2D.getX(i), testSeq2D.getOrdinate(i, CoordinateSequence.X), Math.ulp(10d)); Assert.assertEquals( testSeq2DM.getX(i), testSeq2DM.getOrdinate(i, CoordinateSequence.X), Math.ulp(10d)); Assert.assertEquals( testSeq3D.getX(i), testSeq3D.getOrdinate(i, CoordinateSequence.X), Math.ulp(10d)); Assert.assertEquals( testSeq3DM.getX(i), testSeq3DM.getOrdinate(i, CoordinateSequence.X), Math.ulp(10d)); // Y Assert.assertEquals( testSeq2D.getY(i), testSeq2D.getOrdinate(i, CoordinateSequence.Y), Math.ulp(10d)); Assert.assertEquals( testSeq2DM.getY(i), testSeq2DM.getOrdinate(i, CoordinateSequence.Y), Math.ulp(10d)); Assert.assertEquals( testSeq3D.getY(i), testSeq3D.getOrdinate(i, CoordinateSequence.Y), Math.ulp(10d)); Assert.assertEquals( testSeq3DM.getY(i), testSeq3DM.getOrdinate(i, CoordinateSequence.Y), Math.ulp(10d)); // Z Assert.assertEquals( testSeq2D.getZ(i), testSeq2D.getOrdinate(i, CoordinateSequence.Z), Math.ulp(10d)); Assert.assertEquals( testSeq2DM.getZ(i), testSeq2DM.getOrdinate(i, CoordinateSequence.Z), Math.ulp(10d)); Assert.assertEquals( testSeq3D.getZ(i), testSeq3D.getOrdinate(i, CoordinateSequence.Z), Math.ulp(10d)); Assert.assertEquals( testSeq3DM.getZ(i), testSeq3DM.getOrdinate(i, CoordinateSequence.Z), Math.ulp(10d)); // M Assert.assertEquals( testSeq2D.getM(i), testSeq2D.getOrdinate(i, CoordinateSequence.M), Math.ulp(10d)); Assert.assertEquals( testSeq2DM.getM(i), testSeq2DM.getOrdinate(i, CoordinateSequence.M), Math.ulp(10d)); Assert.assertEquals( testSeq3D.getM(i), testSeq3D.getOrdinate(i, CoordinateSequence.M), Math.ulp(10d)); Assert.assertEquals( testSeq3DM.getM(i), testSeq3DM.getOrdinate(i, CoordinateSequence.M), Math.ulp(10d)); try { testSeq2D.getOrdinate(i, 5); fail(); } catch (IllegalArgumentException e) { // OK } } try { testSeq2D.getOrdinate(2, 5); fail(); } catch (IllegalArgumentException e) { // OK } try { testSeq2D.getOrdinate(4, 1); fail(); } catch (IndexOutOfBoundsException e) { // OK } try { testSeq3D.getOrdinate(3, 0); fail(); } catch (IndexOutOfBoundsException e) { } }