@Test public void testGetX() { assertEquals(0d, testSeq2D.getX(0), Math.ulp(10d)); assertEquals(1d, testSeq2D.getX(1), Math.ulp(10d)); assertEquals(2d, testSeq2D.getX(2), Math.ulp(10d)); assertEquals(0d, testSeq2DM.getX(0), Math.ulp(10d)); assertEquals(1d, testSeq2DM.getX(1), Math.ulp(10d)); assertEquals(2d, testSeq2DM.getX(2), Math.ulp(10d)); assertEquals(0d, testSeq3D.getX(0), Math.ulp(10d)); assertEquals(1d, testSeq3D.getX(1), Math.ulp(10d)); assertEquals(2d, testSeq3D.getX(2), Math.ulp(10d)); assertEquals(0d, testSeq3DM.getX(0), Math.ulp(10d)); assertEquals(1d, testSeq3DM.getX(1), Math.ulp(10d)); assertEquals(2d, testSeq3DM.getX(2), Math.ulp(10d)); try { testSeq3D.getX(3); fail(); } catch (IndexOutOfBoundsException e) { } }
@Test public void testGetM() { assertTrue(Double.isNaN(testSeq2D.getM(0))); assertTrue(Double.isNaN(testSeq2D.getM(1))); assertTrue(Double.isNaN(testSeq2D.getM(2))); assertTrue(Double.isNaN(testSeq3D.getM(0))); assertTrue(Double.isNaN(testSeq3D.getM(1))); assertTrue(Double.isNaN(testSeq3D.getM(2))); assertEquals(0d, testSeq2DM.getM(0), Math.ulp(10d)); assertEquals(1d, testSeq2DM.getM(1), Math.ulp(10d)); assertEquals(2d, testSeq2DM.getM(2), Math.ulp(10d)); assertEquals(1d, testSeq3DM.getM(0), Math.ulp(10d)); assertEquals(2d, testSeq3DM.getM(1), Math.ulp(10d)); assertEquals(3d, testSeq3DM.getM(2), Math.ulp(10d)); try { testSeq3D.getX(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) { } }