Add mjmBody and mjmPlugin and their compiler C APIs.

PiperOrigin-RevId: 604937231
Change-Id: Ib8a2105ce6c0500d6a610258b46f192d9e73169d
This commit is contained in:
Alessio Quaglino
2024-02-07 04:16:20 -08:00
committed by Copybara-Service
parent b9c50ad79c
commit a3e49d582e
17 changed files with 626 additions and 332 deletions
+17
View File
@@ -17,6 +17,7 @@
#include "src/engine/engine_plugin.h"
#include <array>
#include <cstdint>
#include <sstream>
#include <string>
@@ -421,6 +422,22 @@ constexpr char xml[] = R"(
</mujoco>
)";
TEST_F(MujocoTest, EmptyPluginDisallowed) {
static constexpr char xml[] = R"(
<mujoco>
<worldbody>
<plugin/>
</worldbody>
</mujoco>
)";
std::array<char, 1024> error;
mjModel* m = LoadModelFromString(xml, error.data(), error.size());
EXPECT_THAT(m, testing::IsNull()) << error.data();
EXPECT_THAT(error.data(), HasSubstr(
"neither 'plugin' nor 'instance' is specified for body 'world'"));
mj_deleteModel(m);
}
TEST_F(PluginTest, FirstPartyPlugins) {
EXPECT_THAT(mjp_pluginCount(), kNumTruePlugins);
}