aboutsummaryrefslogtreecommitdiff
path: root/pkg/ecl/errtest/test_iferr.cl
blob: 5cf40d6cd145bb2ade936470bfff0b3983b452d4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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