-
Notifications
You must be signed in to change notification settings - Fork 138
/
comp.t
165 lines (148 loc) · 2.48 KB
/
comp.t
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!./parrot
# Copyright (C) 2001-2010, Parrot Foundation.
=head1 NAME
t/op/comp.t - Conditionals
=head1 SYNOPSIS
% prove t/op/comp.t
=head1 DESCRIPTION
Tests various conditional branch operations.
=cut
# some of these were failing with JIT/i386
.sub main :main
.include 'test_more.pir'
plan(17)
test_gt_ic_i_ic()
test_ge_ic_i_ic()
test_le_ic_i_ic()
test_lt_ic_i_ic()
test_eq_ic_i_ic()
test_ne_ic_i_ic()
test_eq_num()
.end
.sub test_gt_ic_i_ic
set $I0, 10
gt 11, $I0, ok1
ok(0, "nok gt1")
branch nok1
ok1:
ok(1, "ok gt1")
nok1:
gt 9, $I0, nok2
ok(1, "ok gt2")
.return()
nok2:
ok(0,"nok gt 2")
.end
.sub test_ge_ic_i_ic
set $I0, 10
ge 11, $I0, ok1
ok(0, "nok ge1")
branch nok1
ok1:
ok(1, "ok ge1")
nok1:
ge 9, $I0, nok2
ok(1, "ok ge2")
branch ok2
nok2:
ok(0, "nok ge2")
ok2:
ge 10, $I0, ok3
ok(0, "nok ge3")
.return()
ok3:
ok(1, "ok ge3")
.end
.sub test_le_ic_i_ic
set $I0, 10
le 9, $I0, ok1
ok(0, "nok le1")
branch nok1
ok1:
ok(1, "ok le1")
nok1:
le 11, $I0, nok2
ok(1, "ok le2")
branch ok2
nok2:
ok(0, "nok le2")
ok2:
le 10, $I0, ok3
ok(0, "nok le2")
.return()
ok3:
ok(1, "ok le3")
.end
.sub test_lt_ic_i_ic
set $I0, 10
lt 9, $I0, ok1
ok(0, "nok lt1")
branch nok1
ok1:
ok(1, "ok lt1")
nok1:
lt 10, $I0, nok2
ok(1, "ok lt2")
.return()
nok2:
ok(0, "nok lt2")
.end
.sub test_eq_ic_i_ic
set $I0, 10
eq 9, $I0, nok1
ok(1, "ok eq1")
branch ok1
nok1:
ok(0, "nok eq1")
ok1:
eq 10, $I0, ok2
ok(0, "nok eq2")
branch nok2
ok2:
ok(1, "ok eq2")
nok2:
eq 11, 10, nok3
ok(1, "ok eq3")
.return()
nok3:
ok(0, "nok eq3")
.end
.sub test_ne_ic_i_ic
set $I0, 10
ne 9, $I0, ok1
ok(0, "nok neq1")
branch nok1
ok1:
ok(1, "ok neq1")
nok1:
ne 10, $I0, nok2
ok(1, "ok neq2")
branch ok2
nok2:
ok(0, "nok neq2")
ok2:
ne 11, 10, ok3
ok(0, "nok neq2")
.return()
ok3:
ok(1, "ok neq3")
.end
.sub test_eq_num
new $P0, 'Float'
set $P0, -1.2
new $P1, 'String'
#
# fix problems with g++ 4.4.1 (with --optimize) on i386 - GH #677
# set $P1, "-1.2"
set $P1, "-1.2000000000"
eq_num $P0, $P1, OK
ok(0, "not eq_num")
.return()
OK:
ok(1, "eq_num")
.end
# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: