public void testGet() {
double[][] data = new double[][] { {10, 20, 30, 40}, {100, 200}, {300}};
// Access every legal element in the data[][] array and verify
// that Array2D.get(row,col) returns the corresponding value.
JavaArray2D a = new JavaArray2D(data);
for (int i = 0; i < data.length; i++) {
double[] row = data[i];
for (int j = 0; j < row.length; j++) {
assertEquals(row[j], a.get(i, j));
}
}
try {
a.get(-1, -1);
fail();
} catch (AssertionError e) {
// expected
}
try {
a.get(0, data[0].length);
fail();
} catch (AssertionError e) {
// expected
}
try {
a.get(data.length, 0);
fail();
} catch (AssertionError e) {
// expected
}