Merge branch 'main' into newton-schemas
This commit is contained in:
@@ -1,60 +0,0 @@
|
||||
// Copyright 2026 DeepMind Technologies Limited
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <mujoco/mjspec.h>
|
||||
#include <mujoco/mujoco.h>
|
||||
#include "test/fixture.h"
|
||||
|
||||
namespace mujoco {
|
||||
namespace {
|
||||
|
||||
using MjzTest = MujocoTest;
|
||||
|
||||
using ::testing::IsNull;
|
||||
using ::testing::Not;
|
||||
using ::testing::NotNull;
|
||||
using ::testing::StrEq;
|
||||
|
||||
TEST_F(MjzTest, Parse) {
|
||||
mjVFS vfs;
|
||||
mj_defaultVFS(&vfs);
|
||||
std::string filepath = GetTestDataFilePath("testdata/model.mjz");
|
||||
char err[1000] = "";
|
||||
mjSpec* spec = mj_parse(filepath.c_str(), "", &vfs, err, sizeof(err));
|
||||
EXPECT_THAT(spec, NotNull());
|
||||
EXPECT_THAT(err, StrEq(""));
|
||||
mjModel* model = mj_compile(spec, &vfs);
|
||||
EXPECT_THAT(model, NotNull()) << mjs_getError(spec);
|
||||
mj_deleteModel(model);
|
||||
mj_deleteSpec(spec);
|
||||
mj_deleteVFS(&vfs);
|
||||
}
|
||||
|
||||
TEST_F(MjzTest, InvalidPath) {
|
||||
mjVFS vfs;
|
||||
mj_defaultVFS(&vfs);
|
||||
std::string filepath = GetTestDataFilePath("testdata/not_a_file.mjz");
|
||||
char err[1000] = "";
|
||||
mjSpec* spec = mj_parse(filepath.c_str(), "", nullptr, err, sizeof(err));
|
||||
EXPECT_THAT(spec, IsNull());
|
||||
EXPECT_THAT(err, Not(StrEq("")));
|
||||
mj_deleteVFS(&vfs);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mujoco
|
||||
@@ -172,6 +172,8 @@ TEST_F(MjcPhysicsSceneTest, TestDefaults) {
|
||||
mjDSBL_EULERDAMP);
|
||||
EXPECT_DISABLE_FLAG_USD_FALLBACK_EQ_MODEL_DEFAULT(AutoResetFlag,
|
||||
mjDSBL_AUTORESET);
|
||||
EXPECT_DISABLE_FLAG_USD_FALLBACK_EQ_MODEL_DEFAULT(MultiCCDFlag,
|
||||
mjDSBL_MULTICCD);
|
||||
|
||||
EXPECT_ENABLE_FLAG_USD_FALLBACK_EQ_MODEL_DEFAULT(OverrideFlag,
|
||||
mjENBL_OVERRIDE);
|
||||
@@ -179,8 +181,6 @@ TEST_F(MjcPhysicsSceneTest, TestDefaults) {
|
||||
EXPECT_ENABLE_FLAG_USD_FALLBACK_EQ_MODEL_DEFAULT(FwdinvFlag, mjENBL_FWDINV);
|
||||
EXPECT_ENABLE_FLAG_USD_FALLBACK_EQ_MODEL_DEFAULT(InvDiscreteFlag,
|
||||
mjENBL_INVDISCRETE);
|
||||
EXPECT_ENABLE_FLAG_USD_FALLBACK_EQ_MODEL_DEFAULT(MultiCCDFlag,
|
||||
mjENBL_MULTICCD);
|
||||
|
||||
mj_deleteModel(default_model);
|
||||
mj_deleteSpec(empty_spec);
|
||||
|
||||
Reference in New Issue
Block a user