@Test public void testGetY() { assertEquals(0d, testSeq2D.getY(0), Math.ulp(10d)); assertEquals(-1d, testSeq2D.getY(1), Math.ulp(10d)); assertEquals(-2d, testSeq2D.getY(2), Math.ulp(10d)); assertEquals(0d, testSeq2DM.getY(0), Math.ulp(10d)); assertEquals(-1d, testSeq2DM.getY(1), Math.ulp(10d)); assertEquals(-2d, testSeq2DM.getY(2), Math.ulp(10d)); assertEquals(0d, testSeq3D.getY(0), Math.ulp(10d)); assertEquals(-1d, testSeq3D.getY(1), Math.ulp(10d)); assertEquals(-2d, testSeq3D.getY(2), Math.ulp(10d)); assertEquals(0d, testSeq3DM.getY(0), Math.ulp(10d)); assertEquals(-1d, testSeq3DM.getY(1), Math.ulp(10d)); assertEquals(-2d, testSeq3DM.getY(2), Math.ulp(10d)); try { testSeq3D.getY(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) { } }