Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/dist/src/sysel/demos/arith.sy

    r23de644 r38aaacc2  
    3030        fun Main() is
    3131                -- Test addition, multiplication and precedence.
    32                 Builtin.WriteLine("2*2 + 2*2 =");
    33                 Builtin.WriteLine(2*2 + 2*2);
    34                 Builtin.WriteLine("(expected: 8)");
     32                Builtin.Write("2*2 + 2*2 = ");
     33                Builtin.Write(2*2 + 2*2);
     34                Builtin.WriteLine(" (expected: 8)");
    3535
    3636                -- Test subtraction, multiplication and precedence.
    37                 Builtin.WriteLine("1111 - 1 - 10 - 10*10 - 10*10*10 =");
    38                 Builtin.WriteLine(1111 - 1 - 10 - 10*10 - 10*10*10);
    39                 Builtin.WriteLine("(expected: 0)");
     37                Builtin.Write("1111 - 1 - 10 - 10*10 - 10*10*10 = ");
     38                Builtin.Write(1111 - 1 - 10 - 10*10 - 10*10*10);
     39                Builtin.WriteLine(" (expected: 0)");
    4040
    4141                -- Test parenthesized sub-expressions.
    42                 Builtin.WriteLine("10 * (1 - 1) =");
    43                 Builtin.WriteLine(10 * (1 - 1));
    44                 Builtin.WriteLine("(expected: 0)");
     42                Builtin.Write("10 * (1 - 1) = ");
     43                Builtin.Write(10 * (1 - 1));
     44                Builtin.WriteLine(" (expected: 0)");
    4545
    4646                -- Test unary plus and minus.
    47                 Builtin.WriteLine("(+1) - (-1) - (+(+1)) + (+(-1)) = ");
    48                 Builtin.WriteLine((+1) - (-1) - (+(+1)) + (+(-1)));
    49                 Builtin.WriteLine("(expected: 0)");
     47                Builtin.Write("(+1) - (-1) - (+(+1)) + (+(-1)) = ");
     48                Builtin.Write((+1) - (-1) - (+(+1)) + (+(-1)));
     49                Builtin.WriteLine(" (expected: 0)");
    5050
    5151                -- Test signed multiplication.
    52                 Builtin.WriteLine("+1 * +1 = ");
    53                 Builtin.WriteLine(+1 * +1);
    54                 Builtin.WriteLine("(expected: 1)");
    55                 Builtin.WriteLine("-1 * -1 = ");
    56                 Builtin.WriteLine(-1 * -1);
    57                 Builtin.WriteLine("(expected: 1)");
    58                 Builtin.WriteLine("+1 * -1 = ");
    59                 Builtin.WriteLine(+1 * -1);
    60                 Builtin.WriteLine("(expected: -1)");
    61                 Builtin.WriteLine("-1 * +1 = ");
    62                 Builtin.WriteLine(-1 * +1);
    63                 Builtin.WriteLine("(expected: -1)");
     52                Builtin.Write("+1 * +1 = ");
     53                Builtin.Write(+1 * +1);
     54                Builtin.WriteLine(" (expected: 1)");
     55
     56                Builtin.Write("-1 * -1 = ");
     57                Builtin.Write(-1 * -1);
     58                Builtin.WriteLine(" (expected: 1)");
     59
     60                Builtin.Write("+1 * -1 = ");
     61                Builtin.Write(+1 * -1);
     62                Builtin.WriteLine(" (expected: -1)");
     63
     64                Builtin.Write("-1 * +1 = ");
     65                Builtin.Write(-1 * +1);
     66                Builtin.WriteLine(" (expected: -1)");
    6467
    6568                -- Test multiplication with large result.
    66                 Builtin.WriteLine("1000000 * 1000000 * 1000000 * 1000000 =");
    67                 Builtin.WriteLine(1000000 * 1000000 * 1000000 * 1000000);
    68                 Builtin.WriteLine("(expected: 1000000000000000000000000)");
     69                Builtin.Write("1000000 * 1000000 * 1000000 * 1000000 = ");
     70                Builtin.Write(1000000 * 1000000 * 1000000 * 1000000);
     71                Builtin.WriteLine(" (expected: 1000000000000000000000000)");
    6972
    7073                -- Test large literals.
    71                 Builtin.WriteLine("1000000000000000000000000 =");
    72                 Builtin.WriteLine(1000000000000000000000000);
    73                 Builtin.WriteLine("(expected: 1000000000000000000000000)");
     74                Builtin.Write("1000000000000000000000000 = ");
     75                Builtin.Write(1000000000000000000000000);
     76                Builtin.WriteLine(" (expected: 1000000000000000000000000)");
    7477
    7578                -- Test large factorials.
Note: See TracChangeset for help on using the changeset viewer.