mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Tests: Add schematic unittests
Improve schematic file-saving interface Add ability to create temporary test files
This commit is contained in:
parent
33c11415bf
commit
2dba29ebf2
8 changed files with 329 additions and 32 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue