Skip to content
Permalink
Browse files

Tests: Modularize unit testing

Split unit tests into separate files under src/unittest/
Give better unittest diagnostics
Clean up some code
  • Loading branch information...
kwolekr committed Apr 26, 2015
1 parent 45a77c8 commit 7220ca906dfc804bd508336f5bed252bcec62ae0
@@ -198,7 +198,6 @@ LOCAL_SRC_FILES := \
jni/src/sound_openal.cpp \
jni/src/staticobject.cpp \
jni/src/subgame.cpp \
jni/src/test.cpp \
jni/src/tool.cpp \
jni/src/treegen.cpp \
jni/src/version.cpp \
@@ -212,6 +211,22 @@ LOCAL_SRC_FILES := \
jni/src/util/sha1.cpp \
jni/src/util/string.cpp \
jni/src/util/timetaker.cpp \
jni/src/unittest/test.cpp \
jni/src/unittest/test_collision.cpp \
jni/src/unittest/test_compression.cpp \
jni/src/unittest/test_connection.cpp \
jni/src/unittest/test_filepath.cpp \
jni/src/unittest/test_inventory.cpp \
jni/src/unittest/test_mapnode.cpp \
jni/src/unittest/test_nodedef.cpp \
jni/src/unittest/test_noise.cpp \
jni/src/unittest/test_profiler.cpp \
jni/src/unittest/test_serialization.cpp \
jni/src/unittest/test_settings.cpp \
jni/src/unittest/test_socket.cpp \
jni/src/unittest/test_utilities.cpp \
jni/src/unittest/test_voxelalgorithms.cpp \
jni/src/unittest/test_voxelmanipulator.cpp \
jni/src/touchscreengui.cpp \
jni/src/database-leveldb.cpp \
jni/src/settings.cpp \
@@ -278,13 +278,9 @@ add_custom_target(GenerateVersion
add_subdirectory(jthread)
add_subdirectory(network)
add_subdirectory(script)
add_subdirectory(unittest)
add_subdirectory(util)


set (unittests_SRCS
test.cpp
)

set(common_SRCS
ban.cpp
cavegen.cpp
@@ -360,7 +356,7 @@ set(common_SRCS
${JTHREAD_SRCS}
${common_SCRIPT_SRCS}
${UTIL_SRCS}
${unittests_SRCS}
${UNITTEST_SRCS}
)


@@ -662,6 +662,12 @@ std::string RemoveRelativePathComponents(std::string path)
return path.substr(0, pos);
}

const char *GetFilenameFromPath(const char *path)
{
const char *filename = strrchr(path, DIR_DELIM_CHAR);
return filename ? filename + 1 : path;
}

bool safeWriteToFile(const std::string &path, const std::string &content)
{
std::string tmp_file = path + ".~mt";
@@ -103,6 +103,10 @@ std::string RemoveLastPathComponent(const std::string &path,
// this does not resolve symlinks and check for existence of directories.
std::string RemoveRelativePathComponents(std::string path);

// Return the filename from a path or the entire path if no directory delimiter
// is found.
const char *GetFilenameFromPath(const char *path);

bool safeWriteToFile(const std::string &path, const std::string &content);

}//fs
@@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "mainmenumanager.h"
#include "irrlichttypes_extrabloated.h"
#include "debug.h"
#include "test.h"
#include "unittest/test.h"
#include "server.h"
#include "filesys.h"
#include "version.h"
Oops, something went wrong.

0 comments on commit 7220ca9

Please sign in to comment.
You can’t perform that action at this time.