Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 174d238f authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

Add testings

parent 50c69615
No related branches found
No related tags found
No related merge requests found
......@@ -222,4 +222,8 @@ add_documented_files(
src/spm_integers.c
)
## Executable and tests
enable_testing()
include(CTest)
# Testing executables
add_subdirectory(tests)
......@@ -167,6 +167,7 @@ spmReadDriver( spm_driver_t driver,
default:
fprintf(stderr, "spmReadDriver: Driver not implemented\n");
return SPM_ERR_UNKNOWN;
}
}
......
......@@ -67,22 +67,22 @@ endforeach()
# RSA
if (PASTIX_WITH_FORTRAN)
foreach(example ${SPM_TESTS} )
add_test(test_rsa_${example} ./${example} --rsa ${CMAKE_SOURCE_DIR}/test/matrix/small.rsa)
add_test(test_rsa_${example} ./${example} --rsa ${CMAKE_SOURCE_DIR}/tests/matrix/small.rsa)
endforeach()
endif()
# Matrix Market
foreach(example ${SPM_TESTS} ${SPM_DOF_TESTS} )
add_test(test_mm_${example} ./${example} --mm ${CMAKE_SOURCE_DIR}/test/matrix/young4c.mtx)
add_test(test_mm_${example} ./${example} --mm ${CMAKE_SOURCE_DIR}/tests/matrix/young4c.mtx)
endforeach()
# Harwell Boeing
foreach(example ${SPM_TESTS} ${SPM_DOF_TESTS} )
add_test(test_hb_${example} ./${example} --hb ${CMAKE_SOURCE_DIR}/test/matrix/orsirr.rua)
add_test(test_hb_${example} ./${example} --hb ${CMAKE_SOURCE_DIR}/tests/matrix/orsirr.rua)
endforeach()
# Matrix Market - Hermitian
foreach(example ${SPM_TESTS} ${SPM_DOF_TESTS} )
add_test(test_mm2_${example} ./${example} --mm ${CMAKE_SOURCE_DIR}/test/matrix/mhd1280b.mtx)
add_test(test_mm2_${example} ./${example} --mm ${CMAKE_SOURCE_DIR}/tests/matrix/mhd1280b.mtx)
endforeach()
......@@ -117,9 +117,14 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
spmReadDriver( driver, filename, &spm, 0 );
rc = spmReadDriver( driver, filename, &spm, 0 );
free(filename);
if ( rc != SPM_SUCCESS ) {
fprintf(stderr, "ERROR: Could not read the file, stop the test !!!\n");
return EXIT_FAILURE;
}
printf(" -- SPM Conversion Test --\n");
spmConvert(SpmCSC, &spm);
......
......@@ -63,9 +63,14 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
spmReadDriver( driver, filename, &original, 0 );
rc = spmReadDriver( driver, filename, &original, 0 );
free(filename);
if ( rc != SPM_SUCCESS ) {
fprintf(stderr, "ERROR: Could not read the file, stop the test !!!\n");
return EXIT_FAILURE;
}
spmtype = original.mtxtype;
printf(" -- SPM Dof Expand Test --\n");
......
......@@ -49,7 +49,7 @@ int main (int argc, char **argv)
int spmtype, mtxtype, fmttype, baseval;
int ret = SPM_SUCCESS;
int err = 0;
int i, dofmax = 3;
int rc, i, dofmax = 3;
/**
* Get options from command line
......@@ -57,9 +57,14 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
spmReadDriver( driver, filename, &original, 0 );
rc = spmReadDriver( driver, filename, &original, 0 );
free(filename);
if ( rc != SPM_SUCCESS ) {
fprintf(stderr, "ERROR: Could not read the file, stop the test !!!\n");
return EXIT_FAILURE;
}
if ( original.flttype == SpmPattern ) {
spmGenFakeValues( &original );
}
......
......@@ -46,7 +46,7 @@ int main (int argc, char **argv)
spm_driver_t driver;
char *filename;
int spmtype, mtxtype, fmttype, baseval;
int ret = SPM_SUCCESS;
int rc = SPM_SUCCESS;
int err = 0;
int i, dofmax = 4;
......@@ -56,9 +56,14 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
spmReadDriver( driver, filename, &original, 0 );
rc = spmReadDriver( driver, filename, &original, 0 );
free(filename);
if ( rc != SPM_SUCCESS ) {
fprintf(stderr, "ERROR: Could not read the file, stop the test !!!\n");
return EXIT_FAILURE;
}
if ( original.flttype == SpmPattern ) {
spmGenFakeValues( &original );
}
......@@ -99,22 +104,22 @@ int main (int argc, char **argv)
switch( spm->flttype ){
case SpmComplex64:
ret = z_spm_norm_check( spm );
rc = z_spm_norm_check( spm );
break;
case SpmComplex32:
ret = c_spm_norm_check( spm );
rc = c_spm_norm_check( spm );
break;
case SpmFloat:
ret = s_spm_norm_check( spm );
rc = s_spm_norm_check( spm );
break;
case SpmDouble:
default:
ret = d_spm_norm_check( spm );
rc = d_spm_norm_check( spm );
}
PRINT_RES(ret);
PRINT_RES(rc);
spmExit( spm );
free(spm);
......
......@@ -46,15 +46,20 @@ int main (int argc, char **argv)
spm_driver_t driver;
char *filename;
int t,spmtype, mtxtype, baseval;
int ret = SPM_SUCCESS;
int rc = SPM_SUCCESS;
int err = 0;
spmGetOptions( argc, argv,
&driver, &filename );
spmReadDriver( driver, filename, &spm, 0 );
rc = spmReadDriver( driver, filename, &spm, 0 );
free(filename);
if ( rc != SPM_SUCCESS ) {
fprintf(stderr, "ERROR: Could not read the file, stop the test !!!\n");
return EXIT_FAILURE;
}
if ( spm.flttype == SpmPattern ) {
spmGenFakeValues( &spm );
}
......@@ -106,22 +111,22 @@ int main (int argc, char **argv)
switch( spm.flttype ){
case SpmComplex64:
ret = z_spm_matvec_check( t, &spm );
rc = z_spm_matvec_check( t, &spm );
break;
case SpmComplex32:
ret = c_spm_matvec_check( t, &spm );
rc = c_spm_matvec_check( t, &spm );
break;
case SpmFloat:
ret = s_spm_matvec_check( t, &spm );
rc = s_spm_matvec_check( t, &spm );
break;
case SpmDouble:
default:
ret = d_spm_matvec_check( t, &spm );
rc = d_spm_matvec_check( t, &spm );
}
PRINT_RES(ret);
PRINT_RES(rc);
}
}
}
......
......@@ -46,7 +46,7 @@ int main (int argc, char **argv)
spm_driver_t driver;
char *filename;
int spmtype, mtxtype, fmttype, baseval;
int ret = SPM_SUCCESS;
int rc = SPM_SUCCESS;
int err = 0;
/**
......@@ -55,9 +55,14 @@ int main (int argc, char **argv)
spmGetOptions( argc, argv,
&driver, &filename );
spmReadDriver( driver, filename, &spm, 0 );
rc = spmReadDriver( driver, filename, &spm, 0 );
free(filename);
if ( rc != SPM_SUCCESS ) {
fprintf(stderr, "ERROR: Could not read the file, stop the test !!!\n");
return EXIT_FAILURE;
}
if ( spm.flttype == SpmPattern ) {
spmGenFakeValues( &spm );
}
......@@ -95,22 +100,22 @@ int main (int argc, char **argv)
switch( spm.flttype ){
case SpmComplex64:
ret = z_spm_norm_check( &spm );
rc = z_spm_norm_check( &spm );
break;
case SpmComplex32:
ret = c_spm_norm_check( &spm );
rc = c_spm_norm_check( &spm );
break;
case SpmFloat:
ret = s_spm_norm_check( &spm );
rc = s_spm_norm_check( &spm );
break;
case SpmDouble:
default:
ret = d_spm_norm_check( &spm );
rc = d_spm_norm_check( &spm );
}
PRINT_RES(ret);
PRINT_RES(rc);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment