Skip to content

Commit

Permalink
Fix converter test
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <mjcarroll@intrinsic.ai>
  • Loading branch information
mjcarroll committed Aug 10, 2023
1 parent b5148eb commit d0062f5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/SDF_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
*/

#include <gtest/gtest.h>

#include <any>
#include <filesystem>

#include <gz/math.hh>
#include <gz/utils/Environment.hh>
#include <gz/utils/SuppressWarning.hh>
Expand Down Expand Up @@ -788,17 +791,17 @@ TEST(SDF, WriteURIPath)
ASSERT_EQ(std::remove(tempFile.c_str()), 0);
ASSERT_EQ(rmdir(tempDir.c_str()), 0);
}

/////////////////////////////////////////////////
TEST(SDF, FindFileModelSDFCurrDir)
{
std::string currDir;

// Get current directory path from $PWD env variable
currDir = sdf::filesystem::current_path();
// Change to a temporary directory before running test
auto prevPath = std::filesystem::current_path();
std::string tmpDir;
ASSERT_TRUE(sdf::testing::TestTmpPath(tmpDir));
std::filesystem::current_path(tmpDir);

// A file named model.sdf in current directory
auto tempFile = currDir + "/model.sdf";
auto tempFile = tmpDir + "/model.sdf";

sdf::SDF tempSDF;
tempSDF.Write(tempFile);
Expand All @@ -815,5 +818,6 @@ TEST(SDF, FindFileModelSDFCurrDir)

// Cleanup
ASSERT_EQ(std::remove(tempFile.c_str()), 0);
std::filesystem::current_path(prevPath);
}
#endif // _WIN32

0 comments on commit d0062f5

Please sign in to comment.