Changeset fc9bb79


Ignore:
Timestamp:
Jul 11, 2020, 6:40:27 PM (15 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
d34575b
Parents:
9f350c4
Message:

temporary fix for batchtest failure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/manipulatorsOutput3.cfa

    r9f350c4 rfc9bb79  
    11#include <fstream.hfa>
     2
    23int main() {
    3     int128 x = 0xffff, y = 0x2;
    4     x <<= 64;
    5     x += 0xffff;
    6     y <<= 64;
    7     y += 0123;
    8     y |= 0x8000000000000000;
    9     x = -x;
    10     sout | x;
    11     sout | sign(x);
    12     x = -x;
    13     sout | sign(x);
    14     sout | nl;
     4        int128 x = 0xffff, y = 0x2;
     5        x <<= 64;
     6        x += 0xffff;
     7        y <<= 64;
     8        y += 0123;
     9        y |= 0x8000000000000000;
     10        x = -x;
     11        sout | x;
     12        sout | sign(x);
     13        x = -x;
     14        sout | sign(x);
     15        sout | nl;
    1516
    16     sout | bin(x);
    17     sout | upcase(bin(x));
    18     sout | nobase(bin(x));
    19     sout | wd( 95, upcase(bin(x)) );
    20     sout | wd( 95,90, upcase(bin(x)) );
    21     sout | wd( 25,30, upcase(hex(x)) );
    22     sout | nl;
     17        sout | bin(x);
     18        sout | upcase(bin(x));
     19        sout | nobase(bin(x));
     20        sout | wd( 95, upcase(bin(x)) );
     21        sout | wd( 95,90, upcase(bin(x)) );
     22        sout | wd( 25,30, upcase(hex(x)) );
     23        sout | nl;
    2324
    24     printf( "%#.10o\n", 0123 );
    25     sout | wd( 1,10, oct(0123) );
    26     sout | oct(x);
    27     sout | nobase(oct(x));
    28     sout | wd( 45, oct(0123) );
    29     sout | wd( 45,40, oct(0123) );
    30     sout | wd( 40,45, oct(0123) );
    31     sout | wd( 45, oct(x) );
    32     sout | wd( 45,40, oct(x) );
    33     sout | wd( 40,45, oct(x) );
     25        printf( "%#.10o\n", 0123 );
     26        sout | wd( 1,10, oct(0123) );
     27        sout | oct(x);
     28        sout | nobase(oct(x));
     29        sout | wd( 45, oct(0123) );
     30        sout | wd( 45,40, oct(0123) );
     31        sout | wd( 40,45, oct(0123) );
     32        sout | wd( 45, oct(x) );
     33        sout | wd( 45,40, oct(x) );
     34        sout | wd( 40,45, oct(x) );
    3435
    35     sout | left(wd( 45, oct(0123) )) | 'X';
    36     sout | left(wd( 45, oct(x) )) | 'X';
    37     sout | left(wd( 45, oct(y) )) | 'X';
    38     sout | left(wd( 45,40, oct(0123) )) | 'X';
    39     sout | left(wd( 45,40, oct(x) )) | 'X';
    40     sout | left(wd( 45,40, oct(y) )) | 'X';
    41     sout | left(wd( 40,45, oct(0123) )) | 'X';
    42     sout | left(wd( 40,45, oct(x) )) | 'X';
    43     sout | left(wd( 40,45, oct(y) )) | 'X';
    44     printf( "%#-1.10oX\n", 0123 );
    45     sout | left(wd( 1,10, oct(0123) )) | 'X';
    46     printf( "%#-40.10oX\n", 0123 );
    47     sout | left(wd( 40,10, oct(0123) )) | 'X';
    48     sout | left(wd( 40,10, oct(x) )) | 'X';
    49     sout | left(wd( 40,10, oct(y) )) | 'X';
    50     sout | left(wd( 10,40, oct(0123) )) | 'X';
    51     sout | left(wd( 10,40, oct(x) )) | 'X';
    52     sout | left(wd( 10,40, oct(y) )) | 'X';
     36        sout | left(wd( 45, oct(0123) )) | 'X';
     37        sout | left(wd( 45, oct(x) )) | 'X';
     38        sout | left(wd( 45, oct(y) )) | 'X';
     39        sout | left(wd( 45,40, oct(0123) )) | 'X';
     40        sout | left(wd( 45,40, oct(x) )) | 'X';
     41        sout | left(wd( 45,40, oct(y) )) | 'X';
     42        sout | left(wd( 40,45, oct(0123) )) | 'X';
     43        sout | left(wd( 40,45, oct(x) )) | 'X';
     44        sout | left(wd( 40,45, oct(y) )) | 'X';
     45        printf( "%#-1.10oX\n", 0123 );
     46        sout | left(wd( 1,10, oct(0123) )) | 'X';
     47        printf( "%#-40.10oX\n", 0123 );
     48        sout | left(wd( 40,10, oct(0123) )) | 'X';
     49        sout | left(wd( 40,10, oct(x) )) | 'X';
     50        sout | left(wd( 40,10, oct(y) )) | 'X';
     51        sout | left(wd( 10,40, oct(0123) )) | 'X';
     52        sout | left(wd( 10,40, oct(x) )) | 'X';
     53        sout | left(wd( 10,40, oct(y) )) | 'X';
    5354
    54     y = 01234567;
    55     sout | left(wd( 45, 49, oct(y) )) | 'X';
    56     y = -y;
    57     sout | wd(0, oct(y)) | 'Y';
    58     sout | left(wd(0, oct(y))) | 'Y';
    59     sout | nl;
     55        y = 01234567;
     56        sout | left(wd( 45, 49, oct(y) )) | 'X';
     57        y = -y;
     58        sout | wd(0, oct(y)) | 'Y';
     59        sout | left(wd(0, oct(y))) | 'Y';
     60        sout | nl;
    6061
    61     sout | hex(x);
    62     sout | upcase(hex(x));
    63     sout | nobase(hex(x));
    64     sout | wd( 45, upcase(hex(x)) );
    65     sout | wd( 45,40, upcase(hex(x)) );
    66     sout | wd( 45,49, upcase(hex(x)) );
    67     sout | left(wd( 45, upcase(hex(x)) )) | 'X';
    68     sout | left(wd( 45,40, upcase(hex(x)) )) | 'X';
    69     sout | left(wd( 45,49, upcase(hex(x)) )) | 'X';
     62        sout | hex(x);
     63        sout | upcase(hex(x));
     64        sout | nobase(hex(x));
     65        sout | wd( 45, upcase(hex(x)) );
     66        sout | wd( 45,40, upcase(hex(x)) );
     67        sout | wd( 45,49, upcase(hex(x)) );
     68        sout | left(wd( 45, upcase(hex(x)) )) | 'X';
     69        sout | left(wd( 45,40, upcase(hex(x)) )) | 'X';
     70        sout | left(wd( 45,49, upcase(hex(x)) )) | 'X';
    7071
    71     sout | nl;
     72        sout | nl;
    7273
    73     int128 divisor = 0x4b3b4ca85a86c47a;
    74     divisor <<= 16;
    75     divisor += 0x98a224000000000;
    76    
    77     // base 2
    78     sout | "base 2";
    79     sout | bin(divisor);
    80     sout | upcase(bin(divisor));
    81     sout | wd(38, upcase(bin(divisor)));
    82     sout | wd(40, upcase(bin(divisor)));
    83     sout | wd(40, 38, upcase(bin(divisor)));
    84     sout | wd(40, 30, upcase(bin(divisor)));
    85     sout | pad0(sign(wd(40, 38, upcase(bin(divisor)))));
    86     sout | nl;
    87    
    88     // oct
    89     sout | "base 8";
    90     sout | upcase(oct(divisor));
    91     sout | wd(38, upcase(oct(divisor)));
    92     sout | wd(40, upcase(oct(divisor)));
    93     sout | wd(40, 38, upcase(oct(divisor)));
    94     sout | wd(40, 30, upcase(oct(divisor)));
    95     sout | pad0(sign(wd(40, 38, upcase(oct(divisor)))));
    96     sout | nl;
     74        int128 divisor = 0x4b3b4ca85a86c47a;
     75        divisor <<= 16;
     76        divisor += 0x98a224000000000;
     77       
     78        // base 2
     79        sout | "base 2";
     80        sout | bin(divisor);
     81        sout | upcase(bin(divisor));
     82        sout | wd(38, upcase(bin(divisor)));
     83        sout | wd(40, upcase(bin(divisor)));
     84        sout | wd(40, 38, upcase(bin(divisor)));
     85        sout | wd(40, 30, upcase(bin(divisor)));
     86        sout | pad0(sign(wd(40, 38, upcase(bin(divisor)))));
     87        sout | nl;
     88       
     89        // oct
     90        sout | "base 8";
     91        sout | upcase(oct(divisor));
     92        sout | wd(38, upcase(oct(divisor)));
     93        sout | wd(40, upcase(oct(divisor)));
     94        sout | wd(40, 38, upcase(oct(divisor)));
     95        sout | wd(40, 30, upcase(oct(divisor)));
     96        sout | pad0(sign(wd(40, 38, upcase(oct(divisor)))));
     97        sout | nl;
    9798
    98     // decimal
    99     sout | "base 10";
    100     sout | divisor;
    101     sout | wd(2, divisor);
    102     sout | wd(3, divisor);
    103     sout | wd(10, divisor);
    104     sout | wd(24, divisor);
    105     sout | wd(38, divisor);
    106     sout | wd(39, divisor);
    107     sout | wd(40, divisor);
    108    
    109     sout | wd(40, 30, divisor);
    110     sout | wd(40, 38, divisor);
    111     sout | wd(40, 40, divisor);
    112     sout | pad0(wd(40, divisor));
    113     sout | pad0(sign(wd(40,divisor)));
    114     sout | nl;
    115    
    116     // hex
    117     sout | "base 16";
    118     sout | upcase(hex(divisor));
    119     sout | wd(38, upcase(hex(divisor)));
    120     sout | wd(40, upcase(hex(divisor)));
    121     sout | wd(40, 38, upcase(hex(divisor)));
    122     sout | wd(40, 30, upcase(hex(divisor)));
    123     sout | pad0(sign(wd(40, 38, upcase(hex(divisor)))));
    124     sout | nl;
     99        // decimal
     100        sout | "base 10";
     101        sout | divisor;
     102        sout | wd(2, divisor);
     103        sout | wd(3, divisor);
     104        sout | wd(10, divisor);
     105        sout | wd(24, divisor);
     106        sout | wd(38, divisor);
     107        sout | wd(39, divisor);
     108        sout | wd(40, divisor);
     109       
     110        sout | wd(40, 30, divisor);
     111        sout | wd(40, 38, divisor);
     112        sout | wd(40, 40, divisor);
     113        sout | pad0(wd(40, divisor));
     114        sout | pad0(sign(wd(40,divisor)));
     115        sout | nl;
     116       
     117        // hex
     118        sout | "base 16";
     119        sout | upcase(hex(divisor));
     120        sout | wd(38, upcase(hex(divisor)));
     121        sout | wd(40, upcase(hex(divisor)));
     122        sout | wd(40, 38, upcase(hex(divisor)));
     123        sout | wd(40, 30, upcase(hex(divisor)));
     124        sout | pad0(sign(wd(40, 38, upcase(hex(divisor)))));
     125        sout | nl;
    125126
    126127
    127     // extras
    128     sout | "extras";
    129     sout | bin(divisor);
    130     sout | upcase(bin(divisor));
    131     sout | oct(divisor);
    132     sout | hex(divisor);
    133     sout | upcase(hex(divisor));
    134     sout | nobase(bin(divisor)) | nobase(oct(divisor)) | nobase(hex(divisor));
    135     sout | sign(divisor);
    136     sout | -divisor;
    137     sout | sign(-divisor);
    138     sout | wd(2, divisor);
    139     sout | wd(3,10,divisor);
    140     sout | left(wd(40,divisor)) | 'X';
    141     sout | left(sign(wd(40, divisor))) | 'X';
    142     sout | left(sign(wd(0,40, divisor))) | 'X';
    143     printf( "%-+1.40dX\n", 123456789 );
     128        // extras
     129        sout | "extras";
     130        sout | bin(divisor);
     131        sout | upcase(bin(divisor));
     132        sout | oct(divisor);
     133        sout | hex(divisor);
     134        sout | upcase(hex(divisor));
     135        sout | nobase(bin(divisor)) | nobase(oct(divisor)) | nobase(hex(divisor));
     136        sout | sign(divisor);
     137        sout | -divisor;
     138        sout | sign(-divisor);
     139        sout | wd(2, divisor);
     140        sout | wd(3,10,divisor);
     141        sout | left(wd(40,divisor)) | 'X';
     142        sout | left(sign(wd(40, divisor))) | 'X';
     143        sout | left(sign(wd(0,40, divisor))) | 'X';
     144        printf( "%-+1.40dX\n", 123456789 );
    144145
    145     int128 i128;
    146     unsigned int128 ui128;
     146        int128 i128;
     147        unsigned int128 ui128;
    147148
    148     i128 = -10;
    149     for ( 25 ) {
     149        i128 = -10;
     150        for ( 25 ) {
    150151        sout | left( sign( wd( 20, i128 ) ) ) | left( wd( 20, hex( i128 ) ) ) | left( wd( 20, oct( i128 ) ) );
    151152        sout | left( wd( 20, bin( i128 ) ) );
    152153        i128 += 1;
    153     }
    154     sout | nl;
     154        }
     155        sout | nl;
     156        i128 = 0x7fffffffffffffff;
     157        i128 <<= 64;
     158        i128 += 0xfffffffffffffffa;
    155159
    156     i128 = 0x7fffffffffffffff;
    157     i128 <<= 64;
    158     i128 += 0xfffffffffffffffa;
    159 
    160     for ( 20 ) {
     160//    for ( 20 ) {
     161        volatile int stop = 20;
     162        for ( int i = 0; i < stop; i += 1 ) {
    161163        sout | i128;
    162164        sout | left( sign( wd( 45, i128 ) ) ) | left( wd( 45, hex( i128 ) ) ) | left( wd( 45, oct( i128 ) ) );
    163165        sout | left( wd( 45, bin( i128 ) ) );
    164166        i128 += 1;
    165     }
    166     sout | nl;
     167        }
     168        sout | nl;
    167169
    168     ui128 = 0x7fffffffffffffff;
    169     ui128 <<= 64;
    170     ui128 += 0xfffffffffffffffa;
    171    
    172     for ( 20 ) {
    173         sout | ui128;
    174         ui128 += 1;
    175     }
    176     sout | nl;
     170        ui128 = 0x7fffffffffffffff;
     171        ui128 <<= 64;
     172        ui128 += 0xfffffffffffffffa;
     173       
     174        for ( 20 ) {
     175                sout | ui128;
     176                ui128 += 1;
     177        }
     178        sout | nl;
    177179
    178     ui128 = 0xffffffffffffffff;
    179     ui128 <<= 64;
    180     ui128 += 0xfffffffffffffffa;
    181    
    182     for ( 20 ) {
    183         sout | ui128;
    184         ui128 += 1;
    185     }
     180        ui128 = 0xffffffffffffffff;
     181        ui128 <<= 64;
     182        ui128 += 0xfffffffffffffffa;
     183       
     184        for ( 20 ) {
     185                sout | ui128;
     186                ui128 += 1;
     187        }
    186188}
     189
     190// Local Variables: //
     191// tab-width: 4 //
     192// compile-command: "cfa -Wall -Wextra amanipulatorsOutput3.cfa" //
     193// End: //
Note: See TracChangeset for help on using the changeset viewer.