Commits (4)
...@@ -121,7 +121,7 @@ add_subdirectory(${PROJECT_MPP_DIR}/src) ...@@ -121,7 +121,7 @@ add_subdirectory(${PROJECT_MPP_DIR}/src)
# Tests # Tests
if (BUILD_TESTS) if (BUILD_TESTS)
include(${PROJECT_MPP_DIR}/tests/CMakeLists.txt) add_subdirectory(${PROJECT_MPP_DIR}/tests/)
endif () endif ()
#---------------------------------------------------------------------------------------# #---------------------------------------------------------------------------------------#
...@@ -7,13 +7,13 @@ from subprocess import Popen, PIPE ...@@ -7,13 +7,13 @@ from subprocess import Popen, PIPE
class Mpp: class Mpp:
PY_FILE_DIR = os.path.dirname(os.path.realpath(__file__)) PY_FILE_DIR = os.path.dirname(os.path.realpath(__file__))
MPP_DIR = os.path.abspath(os.path.join(PY_FILE_DIR, '..')) MPP_ROOT_DIR = os.path.abspath(os.path.join(PY_FILE_DIR, '..'))
MPP_BUILD_DIR = os.path.abspath(os.path.join(MPP_DIR, 'build')) MPP_BUILD_DIR = os.path.abspath(os.path.join(MPP_ROOT_DIR, 'build'))
MPP_LOG_DIR = os.path.abspath(os.path.join(MPP_BUILD_DIR, 'log')) MPP_LOG_DIR = os.path.abspath(os.path.join(MPP_BUILD_DIR, 'log'))
MPP_DATA_DIR = os.path.abspath(os.path.join(MPP_BUILD_DIR, 'data')) MPP_DATA_DIR = os.path.abspath(os.path.join(MPP_BUILD_DIR, 'data'))
MPP_VTK_DATA_DIR = os.path.abspath(os.path.join(MPP_DATA_DIR, 'vtk')) MPP_VTK_DATA_DIR = os.path.abspath(os.path.join(MPP_DATA_DIR, 'vtk'))
MPP_PY_DATA_DIR = os.path.abspath(os.path.join(MPP_DATA_DIR, 'py')) MPP_PY_DATA_DIR = os.path.abspath(os.path.join(MPP_DATA_DIR, 'py'))
PROJECT_ROOT_DIR = os.path.abspath(os.path.join(MPP_DIR, '..')) PROJECT_ROOT_DIR = os.path.abspath(os.path.join(MPP_ROOT_DIR, '..'))
PROJECT_BUILD_DIR = os.path.abspath(os.path.join(PROJECT_ROOT_DIR, 'build')) PROJECT_BUILD_DIR = os.path.abspath(os.path.join(PROJECT_ROOT_DIR, 'build'))
PROJECT_LOG_DIR = os.path.abspath(os.path.join(PROJECT_BUILD_DIR, 'log')) PROJECT_LOG_DIR = os.path.abspath(os.path.join(PROJECT_BUILD_DIR, 'log'))
PROJECT_DATA_DIR = os.path.abspath(os.path.join(PROJECT_BUILD_DIR, 'data')) PROJECT_DATA_DIR = os.path.abspath(os.path.join(PROJECT_BUILD_DIR, 'data'))
...@@ -32,7 +32,7 @@ class Mpp: ...@@ -32,7 +32,7 @@ class Mpp:
def check_git_mpp(self): def check_git_mpp(self):
return self.run_subprocess(['git', 'ls-remote', self.git_mpp_address], return self.run_subprocess(['git', 'ls-remote', self.git_mpp_address],
self.MPP_DIR) self.MPP_ROOT_DIR)
def git_pull_project(self, branch='master'): def git_pull_project(self, branch='master'):
rc_project = self.run_subprocess(['git', 'pull', 'origin', branch], rc_project = self.run_subprocess(['git', 'pull', 'origin', branch],
...@@ -47,7 +47,7 @@ class Mpp: ...@@ -47,7 +47,7 @@ class Mpp:
def git_pull_mpp(self, branch='master'): def git_pull_mpp(self, branch='master'):
return self.run_subprocess(['git', 'pull', 'origin', branch], return self.run_subprocess(['git', 'pull', 'origin', branch],
self.MPP_DIR) self.MPP_ROOT_DIR)
def run_subprocess(self, args, cwd): def run_subprocess(self, args, cwd):
if isinstance(args, list): if isinstance(args, list):
......
...@@ -23,7 +23,7 @@ string VtuPlot::plotLineBreak(int i, int limit, int indent) { ...@@ -23,7 +23,7 @@ string VtuPlot::plotLineBreak(int i, int limit, int indent) {
} }
void VtuPlot::createVtu(const string &filename) { void VtuPlot::createVtu(const string &filename) {
string filepath = Config::getDataPath() + string("/vtk/") + filename + string(".vtu"); string filepath = Config::getDataPath() + string("vtk/") + filename + string(".vtu");
ofstream out(filepath.c_str()); ofstream out(filepath.c_str());
// == Header == // == Header ==
......
# Includes for mpp tests # Includes for mpp tests
#---------------------------------------------------------------------------------------# #---------------------------------------------------------------------------------------#
set(TEST_DIR ${PROJECT_MPP_DIR}/tests)
# Test Executables # Test Executables
add_executable(TestShape ${TEST_DIR}/TestShape.cpp) add_executable(TestShape TestShape.cpp)
add_executable(TestQuadrature ${TEST_DIR}/TestQuadrature.cpp) add_executable(TestQuadrature TestQuadrature.cpp)
add_executable(TestCellConstruction ${TEST_DIR}/TestCellConstruction.cpp) add_executable(TestCellConstruction TestCellConstruction.cpp)
add_executable(TestCellInterface ${TEST_DIR}/TestCellInterface.cpp) add_executable(TestCellInterface TestCellInterface.cpp)
add_executable(TestConfig ${TEST_DIR}/TestConfig.cpp) add_executable(TestConfig TestConfig.cpp)
add_executable(TestChainConfig ${TEST_DIR}/TestChainConfig.cpp) add_executable(TestChainConfig TestChainConfig.cpp)
add_executable(TestVtuPlot TestVtuPlot.cpp)
# Linking # Linking
target_link_libraries(TestShape SRC LIB_PS ${SUPERLU} ${BLAS_LIBRARIES} target_link_libraries(TestShape SRC LIB_PS ${SUPERLU} ${BLAS_LIBRARIES}
...@@ -24,4 +23,6 @@ target_link_libraries(TestConfig SRC LIB_PS ${SUPERLU} ...@@ -24,4 +23,6 @@ target_link_libraries(TestConfig SRC LIB_PS ${SUPERLU}
${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${GTEST_LIB}) ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${GTEST_LIB})
target_link_libraries(TestChainConfig SRC LIB_PS ${SUPERLU} target_link_libraries(TestChainConfig SRC LIB_PS ${SUPERLU}
${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${GTEST_LIB}) ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${GTEST_LIB})
target_link_libraries(TestVtuPlot SRC LIB_PS ${SUPERLU}
${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${GTEST_LIB})
#---------------------------------------------------------------------------------------# #---------------------------------------------------------------------------------------#
#include "gtest/gtest.h"
#include "plot/VtuPlot.h"
#include <memory>
#include "m++.h"
using namespace ::testing;
class TestSerialVtuPlot : public ::Test {
protected:
SerialVtuPlot *plot;
Meshes *meshes;
};
TEST_F(TestSerialVtuPlot, TestConstructor) {
meshes = new Meshes("UnitSquare", 0, 1);
plot = new SerialVtuPlot((*meshes)[0]);
}
int main(int argc, char **argv) {
InitGoogleTest(&argc, argv);
Config::setSearchPath("../../tests/");
Config::setConfigFileName("m++.conf");
DPO dpo(&argc, argv);
TestEventListeners &listeners = UnitTest::GetInstance()->listeners();
if (!PPM->master()) {
delete listeners.Release(listeners.default_result_printer());
}
return RUN_ALL_TESTS();
}
\ No newline at end of file