[cage] Fix pgegrep, which was merely an innocent bystander in the Great Namespace...
[parrot.git] / t / op / comp.t
blobb58108e24f3d6d5d8bd0ccf449e32329c17a9745
1 #!parrot
2 # Copyright (C) 2001-2009, Parrot Foundation.
3 # $Id$
5 =head1 NAME
7 t/op/comp.t - Conditionals
9 =head1 SYNOPSIS
11         % prove t/op/comp.t
13 =head1 DESCRIPTION
15 Tests various conditional branch operations.
17 =cut
19 # some of these were failing with JIT/i386
21 .sub main :main
22     .include 'test_more.pir'
23     plan(17)
24     test_gt_ic_i_ic()
25     test_ge_ic_i_ic()
26     test_le_ic_i_ic()
27     test_lt_ic_i_ic()
28     test_eq_ic_i_ic()
29     test_ne_ic_i_ic()
30     test_eq_num()
31 .end
33 .sub test_gt_ic_i_ic
34     set $I0, 10
35     gt 11, $I0, ok1
36     ok(0, "nok gt1")
37     branch nok1
38   ok1:
39     ok(1, "ok gt1")
40   nok1:
41     gt 9, $I0, nok2
42     ok(1, "ok gt2")
43     .return()
44   nok2:
45     ok(0,"nok gt 2")
46 .end
48 .sub test_ge_ic_i_ic
49     set $I0, 10
50     ge 11, $I0, ok1
51     ok(0, "nok ge1")
52     branch nok1
53   ok1:
54     ok(1, "ok ge1")
55   nok1:
56     ge 9, $I0, nok2
57     ok(1, "ok ge2")
58     branch ok2
59   nok2:
60     ok(0, "nok ge2")
61   ok2:
62     ge 10, $I0, ok3
63     ok(0, "nok ge3")
64     .return()
65   ok3:
66     ok(1, "ok ge3")
67 .end
69 .sub test_le_ic_i_ic
70     set $I0, 10
71     le 9, $I0, ok1
72     ok(0, "nok le1")
73     branch nok1
74   ok1:
75     ok(1, "ok le1")
76   nok1:
77     le 11, $I0, nok2
78     ok(1, "ok le2")
79     branch ok2
80   nok2:
81     ok(0, "nok le2")
82   ok2:
83     le 10, $I0, ok3
84     ok(0, "nok le2")
85     .return()
86   ok3:
87     ok(1, "ok le3")
88 .end
90 .sub test_lt_ic_i_ic
91     set $I0, 10
92     lt 9, $I0, ok1
93     ok(0, "nok lt1")
94     branch nok1
95   ok1:
96     ok(1, "ok lt1")
97   nok1:
98     lt 10, $I0, nok2
99     ok(1, "ok lt2")
100     .return()
101   nok2:
102     ok(0, "nok lt2")
103 .end
105 .sub test_eq_ic_i_ic
106     set $I0, 10
107     eq 9, $I0, nok1
108     ok(1, "ok eq1")
109     branch ok1
110   nok1:
111     ok(0, "nok eq1")
112   ok1:
113     eq 10, $I0, ok2
114     ok(0, "nok eq2")
115     branch nok2
116   ok2:
117     ok(1, "ok eq2")
118   nok2:
119     eq 11, 10, nok3
120     ok(1, "ok eq3")
121     .return()
122   nok3:
123     ok(0, "nok eq3")
124 .end
126 .sub test_ne_ic_i_ic
127     set $I0, 10
128     ne 9, $I0, ok1
129     ok(0, "nok neq1")
130     branch nok1
131   ok1:
132     ok(1, "ok neq1")
133   nok1:
134     ne 10, $I0, nok2
135     ok(1, "ok neq2")
136     branch ok2
137   nok2:
138     ok(0, "nok neq2")
139   ok2:
140     ne 11, 10, ok3
141     ok(0, "nok neq2")
142     .return()
143   ok3:
144     ok(1, "ok neq3")
145 .end
147 .sub test_eq_num
148     new $P0, 'Float'
149     set $P0, -1.2
150     new $P1, 'String'
152 #   fix problems with g++ 4.4.1 (with --optimize) on i386 - TT #1275
153 #   set $P1, "-1.2"
154     set $P1, "-1.2000000000"
155     eq_num $P0, $P1, OK
156     ok(0, "not eq_num")
157     .return()
158   OK:
159     ok(1, "eq_num")
160 .end
162 # Local Variables:
163 #   mode: cperl
164 #   cperl-indent-level: 4
165 #   fill-column: 100
166 # End:
167 # vim: expandtab shiftwidth=4 filetype=pir: