Add (currently-failing) mj_sizeModel test
This commit is contained in:
@@ -18,7 +18,11 @@
|
||||
|
||||
#include <array>
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
@@ -47,6 +51,34 @@ mjModel PartialModel(const mjModel* m) {
|
||||
return partial_model;
|
||||
}
|
||||
|
||||
TEST_F(EngineIoTest, VerifySizeModel) {
|
||||
constexpr char xml[] = R"(
|
||||
<mujoco>
|
||||
<worldbody>
|
||||
<body>
|
||||
<joint/>
|
||||
<geom size="1"/>
|
||||
</body>
|
||||
</worldbody>
|
||||
</mujoco>
|
||||
)";
|
||||
|
||||
std::array<char, 1024> error;
|
||||
mjModel* model = LoadModelFromString(xml, error.data(), error.size());
|
||||
ASSERT_THAT(model, NotNull()) << "Failed to load model: " << error.data();
|
||||
|
||||
std::filesystem::path temp_file = (
|
||||
std::filesystem::temp_directory_path() / "model.mjb");
|
||||
|
||||
mj_saveModel(model, temp_file.string().c_str(), NULL, 0);
|
||||
|
||||
std::uintmax_t file_size = std::filesystem::file_size(temp_file);
|
||||
|
||||
std::filesystem::remove(temp_file);
|
||||
|
||||
EXPECT_EQ(file_size, mj_sizeModel(model));
|
||||
}
|
||||
|
||||
TEST_F(EngineIoTest, MakeDataFromPartialModel) {
|
||||
constexpr char xml[] = R"(
|
||||
<mujoco>
|
||||
|
||||
Reference in New Issue
Block a user