Commit ff7943ee authored by Naumann, Andreas's avatar Naumann, Andreas

added tester, look for testing later

parent 74dc1b04
project(tests)
add_subdirectory(demoimpl)
add_subdirectory(demotest)
add_subdirectory(datacreation EXCLUDE_FROM_ALL)
project(testdatacreation)
include_directories(${AMDiS_SOURCE_DIR})
file(GLOB PROJECTFILES src/*Project.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../demoimpl/src)
file(GLOB PROJECTFILES ${CMAKE_CURRENT_SOURCE_DIR}/../demoimpl/src/*Project.cpp)
set(CREATELINE "")
foreach(projectfile ${PROJECTFILES})
#create creatorname
get_filename_component(CppName ${projectfile} NAME_WE)
string(REPLACE "Project" "" creatorsuffix ${CppName})
set(PROJECTINCLUDE "${CppName}.h")
set(PROJECTINCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/../demoimpl/src/${CppName}.h")
set(CURRENTPROJECTTYPE "${creatorsuffix}demo")
string(TOLOWER "${creatorsuffix}" creatorsuffix_lower)
set(BASENAME "${creatorsuffix_lower}")
configure_file(src/creator_base.cpp src/creator${creatorsuffix}.cpp @ONLY)
add_executable(creator${creatorsuffix} src/creator${creatorsuffix}.cpp src/ProjectList.cpp ${projectfile})
add_executable(creator${creatorsuffix} src/creator${creatorsuffix}.cpp src/ProjectList.cpp)
target_link_libraries(creator${creatorsuffix} ${AMDiS_LIBS} demoimpl)
file(GLOB initfiles RELATIVE ${CMAKE_CURRENT_BINARY_DIR} init/${creatorsuffix_lower}*.dat*)
foreach(initfile ${initfiles})
......
......@@ -20,16 +20,3 @@ void write(SolutionInformation& info, std::string filename) {
assert(false);
}
bool compare(SolutionInformation& info, std::string filename) {
if(info.sysVec != NULL) {
assert(false);
}else if(info.dofVec != NULL) {
DOFVector< double > fileVec(info.dofVec->getFeSpace(), "fileVec");
Mesh fileMesh("",2);
fileMesh = *(info.dofVec->getFeSpace()->getMesh());
ArhReader::read(filename, &fileMesh, &fileVec);
}else
assert(false);
return false;
}
......@@ -3,6 +3,7 @@
#include "@PROJECTINCLUDE@"
typedef @CURRENTPROJECTTYPE@ ProjectType;
std::string basename="@BASENAME@";
void write(SolutionInformation& info, std::string filename);
int main(int argc, char** argv) {
if(argc < 2) {
std::cout<<" need initfile "<<basename<<"*\n";
......
......@@ -20,8 +20,6 @@ struct SolutionInformation {
};
void write(SolutionInformation&, std::string filename);
bool compare(SolutionInformation&, std::string filename);
class Project {
public:
virtual void create(std::string& ) = 0;
......
project(demotest)
include_directories(${AMDiS_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../demoimpl/src)
file(GLOB PROJECTFILES ${CMAKE_CURRENT_SOURCE_DIR}/../demoimpl/src/*Project.cpp)
foreach(projectfile ${PROJECTFILES})
#create creatorname
get_filename_component(CppName ${projectfile} NAME_WE)
string(REPLACE "Project" "" creatorsuffix ${CppName})
set(PROJECTINCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/../demoimpl/src/${CppName}.h")
set(CURRENTPROJECTTYPE "${creatorsuffix}demo")
string(TOLOWER "${creatorsuffix}" creatorsuffix_lower)
set(BASENAME "${creatorsuffix_lower}")
configure_file(src/tester_base.cpp src/tester${creatorsuffix}.cpp @ONLY)
add_executable(tester${creatorsuffix} src/tester${creatorsuffix}.cpp src/Comparer.cpp)
target_link_libraries(tester${creatorsuffix} ${AMDiS_LIBS} demoimpl)
file(GLOB initfiles RELATIVE ${CMAKE_CURRENT_BINARY_DIR} init/${creatorsuffix_lower}*.dat*)
foreach(initfile ${initfiles})
get_filename_component(initfile_ext ${initfile} EXT)
string(REPLACE ".dat." "" initfile_ext "${initfile_ext}")
set(curoutputdatafile "../testdata/${creatorsuffix_lower}_${initfile_ext}.arh")
endforeach(initfile)
endforeach(projectfile)
../testdata/init
\ No newline at end of file
../testdata/macro
\ No newline at end of file
#include "Project.h"
#include "io/ArhReader.h"
bool compare(SolutionInformation& info, std::string filename)
{
if(info.sysVec != NULL) {
assert(false);
}else if(info.dofVec != NULL) {
DOFVector< double > fileVec(info.dofVec->getFeSpace(), "fileVec");
Mesh fileMesh("",2);
fileMesh = *(info.dofVec->getFeSpace()->getMesh());
ArhReader::read(filename, &fileMesh, &fileVec);
DOFVector< double > nsolvec(*(info.dofVec));
}else
assert(false);
return false;
}
#include "Parameters.h"
#include "Project.h"
#include "@PROJECTINCLUDE@"
bool compare(SolutionInformation& info, std::string filename);
typedef @CURRENTPROJECTTYPE@ ProjectType;
std::string basename="@BASENAME@";
int main(int argc, char** argv) {
if(argc < 2) {
std::cout<<" need initfile "<<basename<<"*\n";
return 1;
}
if(argc < 3) {
std::cout<<" also need a destination file "<<basename<<"*\n";
return 2;
}
std::string initfile(argv[1]);
std::string destinationfile(argv[2]);
AMDiS::Parameters::init(false, initfile);
ProjectType project;
ProjectInfo info(&project, initfile, destinationfile);
info.create();
SolutionInformation solinfo;
info.solve(solinfo);
if(compare(solinfo, info.getFilename()))
return 0;
return 1;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment