busybox/shell/ash_test/ash-arith/arith-ternary3.tests
Denys Vlasenko e127985839 shell/math: fix ?: to not evaluate not-taken branches
This fixes ash-arith-arith-ternary1/2.tests

function                                             old     new   delta
evaluate_string                                     1271    1432    +161
arith_apply                                          968    1000     +32
arith                                                 22      36     +14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 207/0)             Total: 207 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2023-06-16 19:51:01 +02:00

4 lines
117 B
Text
Executable file

exec 2>&1
# "EXPR ?..." should check _evaluated_ EXPR,
# not its last value
echo 42:$((1 < 1 ? -1 : 1 > 1 ? 1 : 42))