mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
Tests: Add schematic unittests
Improve schematic file-saving interface Add ability to create temporary test files
This commit is contained in:
@@ -276,9 +276,35 @@ bool TestBase::testModule(IGameDef *gamedef)
|
||||
<< " failures / " << num_tests_run << " tests) - " << tdiff
|
||||
<< "ms" << std::endl;
|
||||
|
||||
if (!m_test_dir.empty())
|
||||
fs::RecursiveDelete(m_test_dir);
|
||||
|
||||
return num_tests_failed == 0;
|
||||
}
|
||||
|
||||
std::string TestBase::getTestTempDirectory()
|
||||
{
|
||||
if (!m_test_dir.empty())
|
||||
return m_test_dir;
|
||||
|
||||
char buf[32];
|
||||
snprintf(buf, sizeof(buf), "%08X", myrand());
|
||||
|
||||
m_test_dir = fs::TempPath() + DIR_DELIM "mttest_" + buf;
|
||||
if (!fs::CreateDir(m_test_dir))
|
||||
throw TestFailedException();
|
||||
|
||||
return m_test_dir;
|
||||
}
|
||||
|
||||
std::string TestBase::getTestTempFile()
|
||||
{
|
||||
char buf[32];
|
||||
snprintf(buf, sizeof(buf), "%08X", myrand());
|
||||
|
||||
return getTestTempDirectory() + DIR_DELIM + buf + ".tmp";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
NOTE: These tests became non-working then NodeContainer was removed.
|
||||
|
Reference in New Issue
Block a user