Ticket #1269: comp_t.patch

File comp_t.patch, 5.3 KB (added by bubaflub, 12 years ago)

patch for t/op/comp.t

  • t/op/comp.t

    diff --git t/op/comp.t t/op/comp.t
    index 00349f4..4dda245 100644
     
    1 #!perl 
    2 # Copyright (C) 2001-2005, Parrot Foundation. 
     1#!parrot 
     2# Copyright (C) 2001-2009, Parrot Foundation. 
    33# $Id$ 
    44 
    5 use strict; 
    6 use warnings; 
    7 use lib qw( . lib ../lib ../../lib ); 
    8 use Test::More; 
    9 use Parrot::Test tests => 7; 
    10  
    115=head1 NAME 
    126 
    137t/op/comp.t - Conditionals 
     
    1610 
    1711        % prove t/op/comp.t 
    1812 
    19 =head1 DESCRIPTION 
     13=head1 DESCRIPT$ION 
    2014 
    2115Tests various conditional branch operations. 
    2216 
     
    2418 
    2519# some of these were failing with JIT/i386 
    2620 
    27 pasm_output_is( <<'CODE', <<OUTPUT, "gt_ic_i_ic" ); 
    28         set I0, 10 
    29         gt 11, I0, ok1 
    30         print "nok gt\n" 
    31 ok1: 
    32         print "ok 1\n" 
    33         gt 9, I0, nok1 
    34         print "ok 2\n" 
    35         branch ok2 
    36 nok1: 
    37         print "nok gt 2\n" 
    38 ok2: 
    39         end 
    40 CODE 
    41 ok 1 
    42 ok 2 
    43 OUTPUT 
    44  
    45 pasm_output_is( <<'CODE', <<OUTPUT, "ge_ic_i_ic" ); 
    46         set I0, 10 
    47         ge 11, I0, ok1 
    48         print "nok ge\n" 
    49 ok1: 
    50         print "ok 1\n" 
    51         ge 9, I0, nok1 
    52         print "ok 2\n" 
    53         branch ok2 
    54 nok1: 
    55         print "nok ge 2\n" 
    56 ok2: 
    57         ge 10, I0, ok3 
    58         print "nok ge 3\n" 
    59 ok3: 
    60         print "ok 3\n" 
    61         end 
    62 CODE 
    63 ok 1 
    64 ok 2 
    65 ok 3 
    66 OUTPUT 
    67  
    68 pasm_output_is( <<'CODE', <<OUTPUT, "le_ic_i_ic" ); 
    69         set I0, 10 
    70         le 9, I0, ok1 
    71         print "nok le\n" 
    72 ok1: 
    73         print "ok 1\n" 
    74         le 11, I0, nok1 
    75         print "ok 2\n" 
    76         branch ok2 
    77 nok1: 
    78         print "nok le 2\n" 
    79 ok2: 
    80         le 10, I0, ok3 
    81         print "nok le 3\n" 
    82 ok3: 
    83         print "ok 3\n" 
    84         end 
    85 CODE 
    86 ok 1 
    87 ok 2 
    88 ok 3 
    89 OUTPUT 
    90  
    91 pasm_output_is( <<'CODE', <<OUTPUT, "lt_ic_i_ic" ); 
    92         set I0, 10 
    93         lt 9, I0, ok1 
    94         print "nok lt\n" 
    95 ok1: 
    96         print "ok 1\n" 
    97         lt 10, I0, nok1 
    98         print "ok 2\n" 
    99         branch ok2 
    100 nok1: 
    101         print "nok lt 2\n" 
    102 ok2: 
    103         end 
    104 CODE 
    105 ok 1 
    106 ok 2 
    107 OUTPUT 
    108  
    109 pasm_output_is( <<'CODE', <<OUTPUT, "eq_ic_i_ic" ); 
    110         set I0, 10 
    111         eq 9, I0, nok1 
    112         print "ok 1\n" 
    113         branch ok1 
    114 nok1: 
    115         print "nok eq\n" 
    116 ok1: 
    117         eq 10, I0, ok2 
    118         print "nok eq 2\n" 
    119         end 
    120 ok2: 
    121         print "ok 2\n" 
    122         eq 11, 10, nok3 
    123         print "ok 3\n" 
    124         end 
    125 nok3: 
    126         print "nok 3 eq \n" 
    127         end 
    128 CODE 
    129 ok 1 
    130 ok 2 
    131 ok 3 
    132 OUTPUT 
    133  
    134 pasm_output_is( <<'CODE', <<OUTPUT, "ne_ic_i_ic" ); 
    135         set I0, 10 
    136         ne 9, I0, ok1 
    137         print "nok 1\n" 
    138         branch nok1 
    139 ok1: 
    140         print "ok 1\n" 
    141 nok1: 
    142         ne 10, I0, nok2 
    143         print "ok 2\n" 
    144         branch ok2 
    145 nok2: 
    146         print "nok 2\n" 
    147 ok2: 
    148         ne 11, 10, ok3 
    149         print "nok 3\n" 
    150         end 
    151 ok3: 
    152         print "ok 3\n" 
    153         end 
    154 CODE 
    155 ok 1 
    156 ok 2 
    157 ok 3 
    158 OUTPUT 
    159  
    160 pasm_output_is( <<'CODE', <<OUTPUT, "eq_num" ); 
    161         new P0, 'Float' 
    162         set P0, -1.2 
    163         new P1, 'String' 
    164         set P1, "-1.2" 
    165         eq_num P0, P1, OK 
    166         print "not " 
    167 OK:     print "ok\n" 
    168         end 
    169 CODE 
    170 ok 
    171 OUTPUT 
     21.sub main :main 
     22    .include 'test_more.pir' 
     23    plan(17) 
     24 
     25    test_gt_ic_i_ic() 
     26    test_ge_ic_i_ic() 
     27    test_le_ic_i_ic() 
     28    test_lt_ic_i_ic() 
     29    test_eq_ic_i_ic() 
     30    test_ne_ic_i_ic() 
     31    test_eq_num() 
     32.end 
     33 
     34.sub test_gt_ic_i_ic 
     35    set $I0, 10 
     36    gt 11, $I0, ok1 
     37    ok(0, "nok gt1") 
     38  ok1: 
     39    ok(1, "ok gt1") 
     40    gt 9, $I0, nok1 
     41    ok(1, "ok gt2") 
     42    .return() 
     43  nok1: 
     44    ok(0,"nok gt 2") 
     45.end 
     46 
     47.sub test_ge_ic_i_ic 
     48    set $I0, 10 
     49    ge 11, $I0, ok1 
     50    ok(0, "nok ge1") 
     51  ok1: 
     52    ok(1, "ok ge1") 
     53    ge 9, $I0, nok1 
     54    ok(1, "ok ge2") 
     55    branch ok2 
     56  nok1: 
     57    ok(0, "nok ge2") 
     58  ok2: 
     59    ge 10, $I0, ok3 
     60    ok(0, "nok ge3") 
     61  ok3: 
     62    ok(1, "ok ge3") 
     63.end 
     64 
     65.sub test_le_ic_i_ic 
     66    set $I0, 10 
     67    le 9, $I0, ok1 
     68    ok(0, "nok le1") 
     69  ok1: 
     70    ok(1, "ok le1") 
     71    le 11, $I0, nok1 
     72    ok(1, "ok le2") 
     73    branch ok2 
     74  nok1: 
     75    ok(0, "nok le2") 
     76  ok2: 
     77    le 10, $I0, ok3 
     78    ok(0, "nok le2") 
     79  ok3: 
     80    ok(1, "ok le3") 
     81.end 
     82 
     83.sub test_lt_ic_i_ic 
     84    set $I0, 10 
     85    lt 9, $I0, ok1 
     86    ok(0, "nok lt1") 
     87  ok1: 
     88    ok(1, "ok lt1") 
     89    lt 10, $I0, nok1 
     90    ok(1, "ok lt2") 
     91    .return() 
     92  nok1: 
     93    ok(0, "nok lt2") 
     94.end 
     95 
     96.sub test_eq_ic_i_ic 
     97    set $I0, 10 
     98    eq 9, $I0, nok1 
     99    ok(1, "ok eq1") 
     100    branch ok1 
     101  nok1: 
     102    ok(0, "nok eq1") 
     103  ok1: 
     104    eq 10, $I0, ok2 
     105    ok(0, "nok eq2") 
     106    branch test1 
     107  ok2: 
     108    ok(1, "ok eq2") 
     109  test1: 
     110    eq 11, 10, nok3 
     111    ok(1, "ok eq3") 
     112    .return() 
     113  nok3: 
     114    ok(0, "nok eq3") 
     115.end 
     116 
     117.sub test_ne_ic_i_ic 
     118    set $I0, 10 
     119    ne 9, $I0, ok1 
     120    ok(0, "nok neq1") 
     121    branch nok1 
     122  ok1: 
     123    ok(1, "ok neq1") 
     124  nok1: 
     125    ne 10, $I0, nok2 
     126    ok(1, "ok neq2") 
     127    branch ok2 
     128  nok2: 
     129    ok(0, "nok neq2") 
     130  ok2: 
     131    ne 11, 10, ok3 
     132    ok(0, "nok neq2") 
     133    .return() 
     134  ok3: 
     135    ok(1, "ok neq3") 
     136.end 
     137 
     138.sub test_eq_num 
     139    new $P0, 'Float' 
     140    set $P0, -1.2 
     141    new $P1, 'String' 
     142    set $P1, "-1.2" 
     143    eq_num $P0, $P1, OK 
     144    ok(0, "not eq_num") 
     145  OK: 
     146    ok(1, "eq_num") 
     147.end 
    172148 
    173149# Local Variables: 
    174150#   mode: cperl 
    175151#   cperl-indent-level: 4 
    176152#   fill-column: 100 
    177153# End: 
    178 # vim: expandtab shiftwidth=4: 
     154# vim: expandtab shiftwidth=4 filetype=pir: