Changeset 200fcb3 for tests/rational.cfa


Ignore:
Timestamp:
Dec 12, 2018, 9:16:12 AM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer
Children:
5ebb1368
Parents:
3d99498
Message:

add auto newline to sout, change endl to nl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/rational.cfa

    r3d99498 r200fcb3  
    1010// Created On       : Mon Mar 28 08:43:12 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 18:00:27 2018
    13 // Update Count     : 68
     12// Last Modified On : Tue Dec  4 21:46:42 2018
     13// Update Count     : 69
    1414//
    1515
     
    2727
    2828int main() {
    29         sout | "constructor" | endl;
     29        sout | "constructor";
    3030        Rational(int) a = { 3 }, b = { 4 }, c;
    31         sout | a | b | c | endl;
     31        sout | a | b | c;
    3232
    3333        a = (Rational(int)){ 4, 8 };
    3434        b = (Rational(int)){ 5, 7 };
    35         sout | a | b | endl;
     35        sout | a | b;
    3636        a = (Rational(int)){ -2, -3 };
    3737        b = (Rational(int)){ 3, -2 };
    38         sout | a | b | endl;
     38        sout | a | b;
    3939        a = (Rational(int)){ -2, 3 };
    4040        b = (Rational(int)){ 3, 2 };
    41         sout | a | b | endl;
     41        sout | a | b;
    4242
    43         sout | "logical" | endl;
     43        sout | "logical";
    4444        a = (Rational(int)){ -2 };
    4545        b = (Rational(int)){ -3, 2 };
    46         sout | a | b | endl;
    47 //      sout | a == 1 | endl; // FIX ME
    48         sout | a != b | endl;
    49         sout | a <  b | endl;
    50         sout | a <= b | endl;
    51         sout | a >  b | endl;
    52         sout | a >= b | endl;
     46        sout | a | b;
     47//      sout | a == 1; // FIX ME
     48        sout | a != b;
     49        sout | a <  b;
     50        sout | a <= b;
     51        sout | a >  b;
     52        sout | a >= b;
    5353
    54         sout | "arithmetic" | endl;
    55         sout | a | b | endl;
    56         sout | a + b | endl;
    57         sout | a - b | endl;
    58         sout | a * b | endl;
    59         sout | a / b | endl;
     54        sout | "arithmetic";
     55        sout | a | b;
     56        sout | a + b;
     57        sout | a - b;
     58        sout | a * b;
     59        sout | a / b;
    6060
    61         sout | "conversion" | endl;
     61        sout | "conversion";
    6262        a = (Rational(int)){ 3, 4 };
    63         sout | widen( a ) | endl;
     63        sout | widen( a );
    6464        a = (Rational(int)){ 1, 7 };
    65         sout | widen( a ) | endl;
     65        sout | widen( a );
    6666        a = (Rational(int)){ 355, 113 };
    67         sout | widen( a ) | endl;
    68         sout | narrow( 0.75, 4 ) | endl;
    69         sout | narrow( 0.14285714285714, 16 ) | endl;
    70         sout | narrow( 3.14159265358979, 256 ) | endl;
     67        sout | widen( a );
     68        sout | narrow( 0.75, 4 );
     69        sout | narrow( 0.14285714285714, 16 );
     70        sout | narrow( 3.14159265358979, 256 );
    7171
    72         sout | "decompose" | endl;
     72        sout | "decompose";
    7373        int n, d;
    7474//      [n, d] = a;
    75 //      sout | a | n | d | endl;
     75//      sout | a | n | d;
    7676
    77         sout | "more tests" | endl;
     77        sout | "more tests";
    7878        Rational(int) x = { 1, 2 }, y = { 2 };
    79         sout | x - y | endl;
    80         sout | x > y | endl;
    81         sout | x | numerator( x, 2 ) | x | endl;
    82         sout | y | denominator( y, -2 ) | y | endl;
     79        sout | x - y;
     80        sout | x > y;
     81        sout | x | numerator( x, 2 ) | x;
     82        sout | y | denominator( y, -2 ) | y;
    8383
    8484        Rational(int) z = { 0, 5 };
    85         sout | z | endl;
     85        sout | z;
    8686
    87         sout | x | numerator( x, 0 ) | x | endl;
     87        sout | x | numerator( x, 0 ) | x;
    8888
    8989        x = (Rational(int)){ 1, MAX } + (Rational(int)){ 1, MAX };
    90         sout | x | endl;
     90        sout | x;
    9191        x = (Rational(int)){ 3, MAX } + (Rational(int)){ 2, MAX };
    92         sout | x | endl;
     92        sout | x;
    9393
    9494        sin | a | b;
    95         sout | a | b | endl;
     95        sout | a | b;
    9696} // main
    9797
Note: See TracChangeset for help on using the changeset viewer.