Migrate tests to use MockWarningHandler for warning interception.

PiperOrigin-RevId: 933656759
Change-Id: Ia21514c302799034bf598445933dd90427284737
This commit is contained in:
Yuval Tassa
2026-06-17 05:06:15 -07:00
committed by Copybara-Service
parent 38c3388046
commit cedaa47d61
9 changed files with 72 additions and 122 deletions
+2 -2
View File
@@ -24,7 +24,6 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include <mujoco/mujoco.h>
#include "test/fixture.h"
namespace mujoco {
@@ -160,7 +159,8 @@ TEST_F(UserUtilTest, StringToVectorInvalidNumber) {
}
TEST_F(UserUtilTest, StringToVectorNan) {
mju_user_warning = nullptr;
MockWarningHandler warning_handler;
warning_handler.ExpectWarnings();
auto v = StringToVector<double>("1 2 nan 3.21");
EXPECT_THAT(v[2], IsNan());
EXPECT_EQ(v[3], 3.21);