diff options
author | svn_bwardell <svn_bwardell@105869f7-3296-0410-a4ea-f4349344b45a> | 2011-08-07 12:43:08 +0000 |
---|---|---|
committer | svn_bwardell <svn_bwardell@105869f7-3296-0410-a4ea-f4349344b45a> | 2011-08-07 12:43:08 +0000 |
commit | f02ccb2663070e74d780bb2e01b0df502bdad8b5 (patch) | |
tree | d5fe708c4021a7cf1d3529b71bc10ff5198341b6 | |
parent | 921173d2d46e1a69b681ec8aab0fbe5429da760a (diff) |
Unconditionally run tests and abort if any fail.
git-svn-id: https://svn.cct.lsu.edu/repos/numrel/LSUThorns/Vectors/trunk@23 105869f7-3296-0410-a4ea-f4349344b45a
-rw-r--r-- | param.ccl | 7 | ||||
-rw-r--r-- | schedule.ccl | 9 | ||||
-rw-r--r-- | src/test.c | 15 |
3 files changed, 10 insertions, 21 deletions
@@ -1,8 +1 @@ # Parameter definitions for thorn Vectors - -KEYWORD tests "Whether to run correctness tests on startup." -{ - "report" :: "Run tests and report any which fail." - "abort" :: "Run tests and abort if any fail." - "skip" :: "Don't run tests." -} "skip"
\ No newline at end of file diff --git a/schedule.ccl b/schedule.ccl index d6c06a9..54e71b6 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -5,10 +5,7 @@ schedule Vectors_Startup at CCTK_STARTUP LANG: C } "Print startup message" -if (CCTK_EQUALS(tests, "report") || CCTK_EQUALS(tests, "abort")) +schedule Vectors_Test at CCTK_PARAMCHECK { - schedule Vectors_Test at CCTK_PARAMCHECK - { - LANG: C - } "Run correctness tests." -} + LANG: C +} "Run correctness tests." @@ -13,7 +13,7 @@ if(vecres == res) \ passed++; \ else \ - CCTK_VWarn(warnlevel, __LINE__, __FILE__, \ + CCTK_VWarn(CCTK_WARN_ALERT, __LINE__, __FILE__, \ CCTK_THORNSTRING, "Failed test %s", testname); \ numtests++; \ } \ @@ -24,12 +24,6 @@ void Vectors_Test(CCTK_ARGUMENTS) DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS; - int warnlevel; - if (CCTK_EQUALS(tests, "abort")) - warnlevel = CCTK_WARN_ABORT; - else - warnlevel = CCTK_WARN_ALERT; - CCTK_INT passed = 0, numtests=0; CCTK_REAL a[CCTK_REAL_VEC_SIZE]; @@ -79,6 +73,11 @@ void Vectors_Test(CCTK_ARGUMENTS) VECTEST("kifthen 0", kifthen(ToReal(0.),bv,cv), signbit(0.)?c[i]:b[i]); VECTEST("kifthen -0", kifthen(ToReal(-0.),bv,cv), signbit(-0.)?c[i]:b[i]); - CCTK_VInfo(CCTK_THORNSTRING, "%d/%d tests passed ", passed, numtests); + if (passed != numtests) + CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING, + "Failed %d correctness tests", numtests - passed); + else + CCTK_VInfo(CCTK_THORNSTRING, "%d/%d tests passed ", passed, numtests); + return; } |