2 # Copyright (C) 2001-2005, Parrot Foundation.
7 t/op/ifunless.t - If/Unless
11 % prove t/op/ifunless.t
15 Tests the conditional C<if> and C<unless> operations.
22 .include 'test_more.pir'
36 unless_i_ic_negative()
38 unless_n_ic_negative()
40 unless_s_ic_helloworld()
44 .sub 'if_i_ic_positive'
48 if $I0 goto if_i_ic_positive_ok
49 goto if_i_ic_positive_end
54 ok($I1, "if_i_ic with a positive integer")
57 .sub 'if_i_ic_negative'
61 if $I0 goto if_i_ic_negative_ok
62 goto if_i_ic_negative_end
67 ok($I1, "if_i_ic with a negative integer")
74 if $I0 goto if_i_ic_zero_end
78 ok($I1, "if_i_ic with integer zero")
81 .sub 'if_n_ic_positive'
85 if $N0 goto if_n_ic_positive_ok
86 goto if_n_ic_positive_end
91 ok($I1, "if_n_ic with a positive float")
94 .sub 'if_n_ic_negative'
98 if $N0 goto if_n_ic_negative_ok
99 goto if_n_ic_negative_end
103 if_n_ic_negative_end:
104 ok($I1, "if_n_ic with a negative float")
111 if $N0 goto if_n_ic_zero_end
115 ok($I1, "if_n_ic with float zero")
118 .sub 'if_s_ic_helloworld'
122 if $S0 goto if_s_ic_helloworld_ok
123 goto if_s_ic_helloworld_end
125 if_s_ic_helloworld_ok:
127 if_s_ic_helloworld_end:
128 ok($I1, "if_s_ic with a non-empty string")
135 if $S0 goto if_s_ic_empty_end
139 ok($I1, "if_n_ic with the empty string")
142 .sub 'unless_i_ic_zero'
146 unless $I0 goto unless_i_ic_zero_ok
147 goto unless_i_ic_zero_end
151 unless_i_ic_zero_end:
152 ok($I1, "unless_i_ic with integer zero")
155 .sub 'unless_i_ic_negative'
159 unless $I0 goto unless_i_ic_negative_end
162 unless_i_ic_negative_end:
163 ok($I1, "unless_i_ic with a negative integer")
166 .sub 'unless_n_ic_zero'
170 unless $N0 goto unless_n_ic_zero_ok
171 goto unless_n_ic_zero_end
175 unless_n_ic_zero_end:
176 ok($I1, "unless_n_ic with float zero")
179 .sub 'unless_n_ic_negative'
183 unless $N0 goto unless_n_ic_negative_end
186 unless_n_ic_negative_end:
187 ok($I1, "unless_n_ic with a negative float")
190 .sub 'unless_s_ic_empty'
194 unless $S0 goto unless_s_ic_empty_ok
195 goto unless_s_ic_empty_end
197 unless_s_ic_empty_ok:
199 unless_s_ic_empty_end:
200 ok($I1, "unless_s_ic with the empty string")
203 .sub 'unless_s_ic_helloworld'
207 unless $S0 goto unless_s_ic_helloworld_end
210 unless_s_ic_helloworld_end:
211 ok($I1, "unless_s_ic with a non-empty string")
218 # vim: expandtab shiftwidth=4 ft=pir: