Ignore:
File:
1 edited

Legend:

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

    r051b3db8 rc5cb943d  
    3030        fun Main(), static is
    3131                -- Test addition, multiplication and precedence.
    32                 Console.Write("2*2 + 2*2 = ");
    33                 Console.Write(2*2 + 2*2);
    34                 Console.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                 Console.Write("1111 - 1 - 10 - 10*10 - 10*10*10 = ");
    38                 Console.Write(1111 - 1 - 10 - 10*10 - 10*10*10);
    39                 Console.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                 Console.Write("10 * (1 - 1) = ");
    43                 Console.Write(10 * (1 - 1));
    44                 Console.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                 Console.Write("(+1) - (-1) - (+(+1)) + (+(-1)) = ");
    48                 Console.Write((+1) - (-1) - (+(+1)) + (+(-1)));
    49                 Console.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                 Console.Write("+1 * +1 = ");
    53                 Console.Write(+1 * +1);
    54                 Console.WriteLine(" (expected: 1)");
     52                Builtin.Write("+1 * +1 = ");
     53                Builtin.Write(+1 * +1);
     54                Builtin.WriteLine(" (expected: 1)");
    5555
    56                 Console.Write("-1 * -1 = ");
    57                 Console.Write(-1 * -1);
    58                 Console.WriteLine(" (expected: 1)");
     56                Builtin.Write("-1 * -1 = ");
     57                Builtin.Write(-1 * -1);
     58                Builtin.WriteLine(" (expected: 1)");
    5959
    60                 Console.Write("+1 * -1 = ");
    61                 Console.Write(+1 * -1);
    62                 Console.WriteLine(" (expected: -1)");
     60                Builtin.Write("+1 * -1 = ");
     61                Builtin.Write(+1 * -1);
     62                Builtin.WriteLine(" (expected: -1)");
    6363
    64                 Console.Write("-1 * +1 = ");
    65                 Console.Write(-1 * +1);
    66                 Console.WriteLine(" (expected: -1)");
     64                Builtin.Write("-1 * +1 = ");
     65                Builtin.Write(-1 * +1);
     66                Builtin.WriteLine(" (expected: -1)");
    6767
    6868                -- Test multiplication with large result.
    69                 Console.Write("1000000 * 1000000 * 1000000 * 1000000 = ");
    70                 Console.Write(1000000 * 1000000 * 1000000 * 1000000);
    71                 Console.WriteLine(" (expected: 1000000000000000000000000)");
     69                Builtin.Write("1000000 * 1000000 * 1000000 * 1000000 = ");
     70                Builtin.Write(1000000 * 1000000 * 1000000 * 1000000);
     71                Builtin.WriteLine(" (expected: 1000000000000000000000000)");
    7272
    7373                -- Test large literals.
    74                 Console.Write("1000000000000000000000000 = ");
    75                 Console.Write(1000000000000000000000000);
    76                 Console.WriteLine(" (expected: 1000000000000000000000000)");
     74                Builtin.Write("1000000000000000000000000 = ");
     75                Builtin.Write(1000000000000000000000000);
     76                Builtin.WriteLine(" (expected: 1000000000000000000000000)");
    7777
    7878                -- Test large factorials.
    7979                var n : int;
    8080
    81                 Console.WriteLine("Factorials:");
     81                Builtin.WriteLine("Factorials:");
    8282                n = 1;
    8383                while n <= 40 do
    84                         Console.WriteLine(Factorial(n));
     84                        Builtin.WriteLine(Factorial(n));
    8585                        n = n + 1;
    8686                end
Note: See TracChangeset for help on using the changeset viewer.