Fix comparison in engine_core_constraint_test.

(was comparing number to itself)

PiperOrigin-RevId: 705053943
Change-Id: I3d179ab4bb2ed1bc1b74b4edec7ce1114ad16b37
This commit is contained in:
Yuval Tassa
2024-12-11 04:10:06 -08:00
committed by Copybara-Service
parent 049a260102
commit 3ca97248a3
+10 -6
View File
@@ -477,6 +477,7 @@ TEST_F(CoreConstraintTest, MulJacTVecIsland) {
mj_deleteModel(model);
}
// compare mj_constraintUpdate and mj_constraintUpdate_island
TEST_F(CoreConstraintTest, ConstraintUpdateIsland) {
const std::string xml_path = GetTestDataFilePath(kIlslandEfcPath);
mjModel* model = mj_loadXML(xml_path.c_str(), nullptr, nullptr, 0);
@@ -557,12 +558,15 @@ TEST_F(CoreConstraintTest, ConstraintUpdateIsland) {
}
// compare cone Hessians
for (int c=0; c < data2->ncon; c++) {
int efcadr = data2->contact[c].efc_address;
if (data2->efc_island[efcadr] == island) {
for (int j=0; j < 36; j++) {
EXPECT_THAT(data2->contact[c].H[j],
DoubleNear(data2->contact[c].H[j], 1e-12));
if (cone == mjCONE_ELLIPTIC) {
for (int c=0; c < data2->ncon; c++) {
int efcadr = data2->contact[c].efc_address;
if (data2->efc_island[efcadr] == island &&
data2->efc_state[efcadr] == mjCNSTRSTATE_CONE) {
for (int j=0; j < 36; j++) {
EXPECT_THAT(data2->contact[c].H[j],
DoubleNear(data1->contact[c].H[j], 1e-12));
}
}
}
}