aboutsummaryrefslogtreecommitdiff
path: root/pkg/vocl/errtest/test_iferr.cl
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /pkg/vocl/errtest/test_iferr.cl
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/vocl/errtest/test_iferr.cl')
-rw-r--r--pkg/vocl/errtest/test_iferr.cl33
1 files changed, 33 insertions, 0 deletions
diff --git a/pkg/vocl/errtest/test_iferr.cl b/pkg/vocl/errtest/test_iferr.cl
new file mode 100644
index 00000000..5cf40d6c
--- /dev/null
+++ b/pkg/vocl/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