java hash
Archived 3 years ago
S
stefi
Can someone help, i cant get this Test right? I changed the Method hashCode and equals right in my Code so this Test is working...
@Test
public void testEqualsAndHashCode() {
double[][] values = randomValues(8, 10);
double[][] values2 = new double[8][10];
for (int i = 0; i < values.length; i++) {
for (int j = 0; j < values[i].length; j++) {
double d = values[i][j] * 1e-8;
values2[i][j] = d * 1e8;
}
}
Matrix a = new Matrix(values);
Matrix b = new Matrix(values2);
assertEquals(a, b);
assertEquals(a.hashCode(), b.hashCode());
a = unitMatrix(55);
b = unitMatrix(55);
assertEquals(a, b);
assertEquals(a.hashCode(), b.hashCode());
}
