Start modifying the tests structure.

Former-commit-id: 2e95b72fb3258fddd75a3b9c2ab23aa53b0a9d9a
This commit is contained in:
Marek Nečada 2019-08-17 13:57:24 +03:00
parent 5820de30ef
commit 0b0ebf2bce
60 changed files with 42 additions and 36 deletions

View File

@ -29,4 +29,7 @@ cmake_add_fortran_subdirectory (amos
LIBRARIES amos LIBRARIES amos
NO_EXTERNAL_INSTALL) NO_EXTERNAL_INSTALL)
add_subdirectory (qpms) add_subdirectory (qpms)
add_subdirectory (tests)
#add_subdirectory (apps/transop-ewald) #add_subdirectory (apps/transop-ewald)

8
tests/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
add_executable( test_vswf_translations_array test_vswf_translations_array.c )
target_link_libraries( test_vswf_translations_array qpms gsl blas lapacke amos m )
target_include_directories ( test_vswf_translations_array PRIVATE .. )
add_executable( test_vswf_translations test_vswf_translations.c )
target_link_libraries( test_vswf_translations qpms gsl blas lapacke amos m )
target_include_directories ( test_vswf_translations PRIVATE .. )

View File

@ -1,14 +1,14 @@
//c99 -o test_vswf_translations -ggdb -I ../../amos -I .. test_vswf_translations.c ../translations.c ../gaunt.c -lgsl -lm -lblas ../vecprint.c ../vswf.c ../legendre.c ../error.c ../bessel.c ../../amos/libamos.a -lgfortran //c99 -o test_vswf_translations -ggdb -I .. test_vswf_translations.c -lqpms -lgsl -lm -lblas
#include "translations.h" #include <qpms/translations.h>
#include "vswf.h" #include <qpms/vswf.h>
#include <stdio.h> #include <stdio.h>
#include <gsl/gsl_rng.h> #include <gsl/gsl_rng.h>
#include <gsl/gsl_math.h> #include <gsl/gsl_math.h>
#include <gsl/gsl_randist.h> #include <gsl/gsl_randist.h>
#include <assert.h> #include <assert.h>
#include "vectors.h" #include <qpms/vectors.h>
#include "string.h" #include <string.h>
#include "indexing.h" #include <qpms/indexing.h>
char *normstr(qpms_normalisation_t norm) { char *normstr(qpms_normalisation_t norm) {
//int csphase = qpms_normalisation_t_csphase(norm); //int csphase = qpms_normalisation_t_csphase(norm);

View File

@ -1,29 +1,25 @@
//c99 -o test_vswf_translations_array -ggdb -I .. test_vswf_translations_array.c ../translations.c ../gaunt.c -lgsl -lm -lblas ../vecprint.c ../vswf.c ../legendre.c //c99 -o test_vswf_translations_array -ggdb -I .. test_vswf_translations_array.c -lqpms -lgsl -lm -lblas
#include "translations.h" #include <qpms/translations.h>
#include "vswf.h" #include <qpms/vswf.h>
#include <stdio.h> #include <stdio.h>
#include <gsl/gsl_rng.h> #include <gsl/gsl_rng.h>
#include <gsl/gsl_math.h> #include <gsl/gsl_math.h>
#include <gsl/gsl_randist.h> #include <gsl/gsl_randist.h>
#include <assert.h> #include <assert.h>
#include "vectors.h" #include <qpms/vectors.h>
#include "string.h" #include <string.h>
#include "indexing.h" #include <qpms/indexing.h>
char *normstr(qpms_normalisation_t norm) { char *normstr(qpms_normalisation_t norm) {
//int csphase = qpms_normalisation_t_csphase(norm); //int csphase = qpms_normalisation_t_csphase(norm);
norm = qpms_normalisation_t_normonly(norm); norm = norm & QPMS_NORMALISATION_NORM_BITS;
switch (norm) { switch (norm) {
case QPMS_NORMALISATION_NONE: case QPMS_NORMALISATION_NORM_NONE:
return "none"; return "none";
case QPMS_NORMALISATION_SPHARM: case QPMS_NORMALISATION_NORM_SPHARM:
return "spharm"; return "spharm";
case QPMS_NORMALISATION_POWER: case QPMS_NORMALISATION_NORM_POWER:
return "power"; return "power";
#ifdef USE_XU_ANTINORMALISATION
case QPMS_NORMALISATION_XU:
return "xu";
#endif
default: default:
return "!!!undef!!!"; return "!!!undef!!!";
} }
@ -61,22 +57,21 @@ int main() {
w->z = gsl_ran_gaussian(rng, sigma); w->z = gsl_ran_gaussian(rng, sigma);
} }
for(int use_csbit = 0; use_csbit <= 1; ++use_csbit) { for(int use_csbit = 0; use_csbit <= 1; ++use_csbit) {
for(int i = 1; for(int i = 0; i < 3; ++i){
#ifdef USE_XU_ANTINORMALISATION qpms_normalisation_t norm = ((qpms_normalisation_t[])
i <= 4; { QPMS_NORMALISATION_NORM_SPHARM,
#else QPMS_NORMALISATION_NORM_POWER,
i <= 3; QPMS_NORMALISATION_NORM_NONE
#endif })[i]
++i){ | (use_csbit ? QPMS_NORMALISATION_CSPHASE : 0);
qpms_normalisation_t norm = i | (use_csbit ? QPMS_NORMALISATION_T_CSBIT : 0); qpms_trans_calculator *c = qpms_trans_calculator_init(lMax, norm);
qpms_trans_calculator *c = qpms_trans_calculator_init(lMax, norm); for(int J = 1; J <= 4; ++J)
for(int J = 1; J <= 4; ++J) test_sphwave_translation(c, J, o2minuso1, npoints, points);
test_sphwave_translation(c, J, o2minuso1, npoints, points); qpms_trans_calculator_free(c);
qpms_trans_calculator_free(c); }
}
} }
gsl_rng_free(rng); gsl_rng_free(rng);
} }