@Test public final void testStorage() { final T m = this.newMatrix(); m.setRowColumnD(0, 0, 0.0); m.setRowColumnD(0, 1, 1.0); m.setRowColumnD(1, 0, 100.0); m.setRowColumnD(1, 1, 101.0); { final DoubleBuffer b = m.getDirectDoubleBuffer(); Assert.assertEquals(ByteOrder.nativeOrder(), b.order()); Assert.assertEquals(0L, (long) b.position()); Assert.assertEquals(0.0, b.get(0), 0.0); Assert.assertEquals(100.0, b.get(1), 0.0); Assert.assertEquals(1.0, b.get(2), 0.0); Assert.assertEquals(101.0, b.get(3), 0.0); } }
@Test public final void testOutOfBoundsIndexSet() { final T v = this.newMatrixAtIndexFromSize(200L, 200L); int errors = 0; for (int row = 0; row < 4; ++row) { for (int col = 0; col < 4; ++col) { try { v.setRowColumnD(row, col, errors); } catch (final IndexOutOfBoundsException e) { ++errors; } } } Assert.assertEquals(16L, (long) errors); }