summaryrefslogtreecommitdiff
path: root/Dragon/data/assertS.c2m
diff options
context:
space:
mode:
authorstainer_t <thomas.stainer@oecd-nea.org>2025-09-08 13:48:49 +0200
committerstainer_t <thomas.stainer@oecd-nea.org>2025-09-08 13:48:49 +0200
commit7dfcc480ba1e19bd3232349fc733caef94034292 (patch)
tree03ee104eb8846d5cc1a981d267687a729185d3f3 /Dragon/data/assertS.c2m
Initial commit from Polytechnique Montreal
Diffstat (limited to 'Dragon/data/assertS.c2m')
-rw-r--r--Dragon/data/assertS.c2m36
1 files changed, 36 insertions, 0 deletions
diff --git a/Dragon/data/assertS.c2m b/Dragon/data/assertS.c2m
new file mode 100644
index 0000000..1b9c714
--- /dev/null
+++ b/Dragon/data/assertS.c2m
@@ -0,0 +1,36 @@
+*
+* Assert procedure for non-regression testing
+* Recover a value from a real array
+* Author: A. Hebert
+*
+PARAMETER LCMNAM :: ::: LINKED_LIST LCMNAM ; ;
+CHARACTER KEY ;
+INTEGER ISET IPOS ;
+REAL REFVALUE ;
+:: >>KEY<< >>IPOS<< >>REFVALUE<< ;
+INTEGER ITYLCM ;
+REAL VALUE DELTA ;
+DOUBLE PRECISION DVALUE ;
+MODULE GREP: ABORT: END: ;
+*
+GREP: LCMNAM :: TYPE <<KEY>> >>ITYLCM<< ;
+IF ITYLCM 2 = THEN
+ GREP: LCMNAM :: GETVAL <<KEY>> <<IPOS>> >>VALUE<< ;
+ELSEIF ITYLCM 4 = THEN
+ GREP: LCMNAM :: GETVAL <<KEY>> <<IPOS>> >>DVALUE<< ;
+ EVALUATE VALUE := DVALUE D_TO_R ;
+ELSE
+ PRINT "assertS: INVALID TYPE=" ITYLCM ;
+ ABORT: ;
+ENDIF ;
+EVALUATE DELTA := VALUE REFVALUE - REFVALUE / ABS ;
+IF DELTA 1.0E-4 < THEN
+ PRINT "TEST SUCCESSFUL; DELTA=" DELTA ;
+ELSE
+ PRINT "------------" ;
+ PRINT "TEST FAILURE" ;
+ PRINT "------------" ;
+ PRINT "REFERENCE=" REFVALUE " CALCULATED=" VALUE ;
+ ABORT: ;
+ENDIF ;
+END: ;