diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6be118640b10b7cf4c4e8730c32ee7697a8d4507..f3a300bfc848e04686c96b5d795fe3f2dfc236ca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -198,6 +198,10 @@ sanity_stage: - valgrind --leak-check=full --log-file=valgrind.log ./test_cluster_outputs - grep "0 errors from 0 contexts" valgrind.log - rm -rf c_OCLU_24 + - chmod +x test_inclusion_outputs + - rm valgrind.log + - valgrind --leak-check=full --log-file=valgrind.log ./test_inclusion_outputs + - grep "0 errors from 0 contexts" valgrind.log running_stage: stage: run diff --git a/build/Makefile b/build/Makefile index 938b3357f44cd1781a804305ac6247914d34c799..cba30075e68395cbbb87ea589cb98b5d691a00da 100644 --- a/build/Makefile +++ b/build/Makefile @@ -29,8 +29,8 @@ NP_SPHERE_BINS=sphere/np_sphere NP_TRAPPING_SRCS=../src/trapping/np_trapping.cpp ../src/trapping/cfrfme.cpp ../src/trapping/clffft.cpp NP_TRAPPING_OBJS=../src/trapping/np_trapping.o ../src/trapping/cfrfme.o ../src/trapping/clffft.o NP_TRAPPING_BINS=trapping/np_trapping -NP_TESTING_OBJS=../src/testing/test_cluster_outputs.o ../src/testing/test_ParticleDescriptor.o ../src/testing/test_TEDF.o ../src/testing/test_TTMS.o -NP_TESTING_BINS=testing/test_cluster_outputs testing/test_ParticleDescriptor testing/test_TEDF testing/test_TTMS +NP_TESTING_OBJS=../src/testing/test_cluster_outputs.o ../src/testing/test_inclusion_outputs.o ../src/testing/test_ParticleDescriptor.o ../src/testing/test_TEDF.o ../src/testing/test_TTMS.o +NP_TESTING_BINS=testing/test_cluster_outputs testing/test_inclusion_outputs testing/test_ParticleDescriptor testing/test_TEDF testing/test_TTMS all: $(NPTM_LIB) $(FORTRAN_BINS) $(NP_CLUSTER_BINS) $(NP_INCLUSION_BINS) $(NP_SPHERE_BINS) $(NP_TRAPPING_BINS) $(NP_TESTING_BINS) @@ -86,6 +86,9 @@ testing/test_ParticleDescriptor: $(NPTM_LIB) ../src/testing/test_ParticleDescrip testing/test_cluster_outputs: $(NPTM_LIB) ../src/testing/test_cluster_outputs.o $(CXX) $(CXXFLAGS) ../src/testing/test_cluster_outputs.o -o $@ $(CXXLDFLAGS) +testing/test_inclusion_outputs: $(NPTM_LIB) ../src/testing/test_inclusion_outputs.o + $(CXX) $(CXXFLAGS) ../src/testing/test_inclusion_outputs.o -o $@ $(CXXLDFLAGS) + testing/test_TEDF: $(NPTM_LIB) ../src/testing/test_TEDF.o $(CXX) $(CXXFLAGS) ../src/testing/test_TEDF.o -o $@ $(CXXLDFLAGS) diff --git a/src/testing/test_inclusion_outputs.cpp b/src/testing/test_inclusion_outputs.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e546e8989069dafe5ce35dc4174dec5fcdf83fc1 --- /dev/null +++ b/src/testing/test_inclusion_outputs.cpp @@ -0,0 +1,67 @@ +#include <string> + +#ifndef INCLUDE_TYPES_H_ +#include "../include/types.h" +#endif + +#ifndef INCLUDE_ERRORS_H_ +#include "../include/errors.h" +#endif + +#ifndef INCLUDE_CONFIGURATION_H_ +#include "../include/Configuration.h" +#endif + +#ifndef INCLUDE_COMMONS_H_ +#include "../include/Commons.h" +#endif + +#ifndef INCLUDE_OUTPUTS_H_ +#include "../include/outputs.h" +#endif + +using namespace std; + +int test_inclusion_hdf5_output(); +int test_inclusion_devel(); + +int main() { + int result = 0; + // result += test_inclusion_hdf5_output(); // 1 if failed + result += test_inclusion_devel(); // 10 if failed + return result; +} + +int test_inclusion_hdf5_output() { + int result = 0; + /* + try { + const string hdf5_file = "../../test_data/cluster/c_OCLU_24.hd5"; + ClusterOutputInfo *oi = new ClusterOutputInfo(hdf5_file); + oi->write("c_OCLU_24", "LEGACY"); + delete oi; + } catch (const exception& ex) { + result = 1; + } + */ + return result; +} + +int test_inclusion_devel() { + int result = 0; + try { + const string geom_data_file = "../../test_data/inclusion/DINCLU"; + const string scat_data_file = "../../test_data/inclusion/DEDFB"; + mixMPI *mpidata = new mixMPI(); + GeometryConfiguration *gconf = GeometryConfiguration::from_legacy(geom_data_file); + ScattererConfiguration *sconf = ScattererConfiguration::from_dedfb(scat_data_file); + InclusionOutputInfo *oi = new InclusionOutputInfo(sconf, gconf, mpidata); + delete gconf; + delete sconf; + delete oi; + delete mpidata; + } catch (const exception& ex) { + result = 10; + } + return result; +}