aboutsummaryrefslogtreecommitdiff
path: root/src/unittest/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/unittest/test.cpp')
-rw-r--r--src/unittest/test.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/unittest/test.cpp b/src/unittest/test.cpp
index 41ccf0d2d..570807ba7 100644
--- a/src/unittest/test.cpp
+++ b/src/unittest/test.cpp
@@ -19,10 +19,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "test.h"
-#include "log.h"
#include "nodedef.h"
#include "itemdef.h"
#include "gamedef.h"
+#include "mods.h"
content_t t_CONTENT_STONE;
content_t t_CONTENT_GRASS;
@@ -59,6 +59,16 @@ public:
void defineSomeNodes();
+ virtual const std::vector<ModSpec> &getMods() const
+ {
+ static std::vector<ModSpec> testmodspec;
+ return testmodspec;
+ }
+ virtual const ModSpec* getModSpec(const std::string &modname) const { return NULL; }
+ virtual std::string getModStoragePath() const { return "."; }
+ virtual bool registerModStorage(ModMetadata *meta) { return true; }
+ virtual void unregisterModStorage(const std::string &name) {}
+
private:
IItemDefManager *m_itemdef;
INodeDefManager *m_nodedef;
@@ -219,7 +229,7 @@ bool run_tests()
{
DSTACK(FUNCTION_NAME);
- u32 t1 = porting::getTime(PRECISION_MILLI);
+ u64 t1 = porting::getTimeMs();
TestGameDef gamedef;
g_logger.setLevelSilenced(LL_ERROR, true);
@@ -236,7 +246,7 @@ bool run_tests()
num_total_tests_run += testmods[i]->num_tests_run;
}
- u32 tdiff = porting::getTime(PRECISION_MILLI) - t1;
+ u64 tdiff = porting::getTimeMs() - t1;
g_logger.setLevelSilenced(LL_ERROR, false);
@@ -263,12 +273,12 @@ bool run_tests()
bool TestBase::testModule(IGameDef *gamedef)
{
rawstream << "======== Testing module " << getName() << std::endl;
- u32 t1 = porting::getTime(PRECISION_MILLI);
+ u64 t1 = porting::getTimeMs();
runTests(gamedef);
- u32 tdiff = porting::getTime(PRECISION_MILLI) - t1;
+ u64 tdiff = porting::getTimeMs() - t1;
rawstream << "======== Module " << getName() << " "
<< (num_tests_failed ? "failed" : "passed") << " (" << num_tests_failed
<< " failures / " << num_tests_run << " tests) - " << tdiff