Mercurial > octave-nkf
comparison test/parser.tst @ 17622:fd712a12fe53
compatibility for power operator precedence and direction (bug #33304)
* oct-parse.in.yy (power_expr): New non-terminal.
(oper_expr): Use it for the RHS of POW and EPOW operators.
* parser.tst: New tests.
author | Axel Mathéi <axel.mathei@gmail.com> |
---|---|
date | Thu, 10 Oct 2013 12:15:18 -0400 |
parents | 577a19afdaf5 |
children | b92242ad316f |
comparison
equal
deleted
inserted
replaced
17621:d41c8f96ed06 | 17622:fd712a12fe53 |
---|---|
78 %! b +=a ++; | 78 %! b +=a ++; |
79 %! assert (b, 7); | 79 %! assert (b, 7); |
80 | 80 |
81 ## Level 11 (transpose and exponentiation) | 81 ## Level 11 (transpose and exponentiation) |
82 %!test | 82 %!test |
83 %! a = 2; | |
84 %! assert (2 ^a++, 4) | |
85 %! assert (a, 3) | |
86 %! assert (2 ^--a ^2, 16) | |
87 %! assert (a, 2) | |
88 %! assert (2 ^++a, 8) | |
89 %! assert (a, 3) | |
90 %! assert (a' ^2, 9) | |
91 %! assert (2 ^sin(0), 1) | |
83 %! assert (-2 ^2, -4); | 92 %! assert (-2 ^2, -4); |
93 %! assert (2 ^+1 ^3, 8) | |
94 %! assert (2 ^-1 ^3, 0.125) | |
95 %! assert (2 ^~0 ^2, 4) | |
84 %! assert (!0 ^0, false); | 96 %! assert (!0 ^0, false); |
85 %! assert (2*3 ^2, 18); | 97 %! assert (2*3 ^2, 18); |
86 %! assert (2+3 ^2, 11); | 98 %! assert (2+3 ^2, 11); |
87 %! assert ([1:10](1:2 ^2), [1 2 3 4]); | 99 %! assert ([1:10](1:2 ^2), [1 2 3 4]); |
88 %! assert (3>2 ^2, false); | 100 %! assert (3>2 ^2, false); |