diff options
Diffstat (limited to 'pkg/ecl/errtest/test_iferr.cl')
-rw-r--r-- | pkg/ecl/errtest/test_iferr.cl | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/pkg/ecl/errtest/test_iferr.cl b/pkg/ecl/errtest/test_iferr.cl new file mode 100644 index 00000000..5cf40d6c --- /dev/null +++ b/pkg/ecl/errtest/test_iferr.cl @@ -0,0 +1,33 @@ +#{ TEST_IFERR -- Test various iferr constructs. + +procedure test_iferr (type) + +int type { prompt = "Error test code: " } + +begin + printf ("Testing iferr....\n\t") + for (i=1; i <= 5; i=i+1) { + iferr { errif (i) } then { + print (" error from test #"//i) + } else { + print (" NO error from test #"//i) + } + } + + printf ("\n\n") + printf ("Testing divzero error....\n\t") + iferr { i = 1 / 0 } then { + print (" error from divzero test") + } else { + print (" NO error from divzero test") + } + ; + + printf ("\n\n") + printf ("Testing fdivzero error....\n\t") + iferr { x = 1.0 / 0.0 } then { + print (" error from fdivzero test") + } else { + print (" NO error from fdivzero test") + } +end |