add string slices

This commit is contained in:
2018-05-02 10:33:08 +02:00
parent 03d1c8755c
commit ec0b33f1bb
3 changed files with 215 additions and 40 deletions
+6 -7
View File
@@ -1,7 +1,10 @@
#var exprDebug 1
x=3, !3, -3, ~3, 3?
# $(x) should be: 3, 0, -3, -4, 1
x=3, !3, !!3, -3, --3, ~3, ~~3, 3?, 3??
# $(x) should be: 3, 0, 1, -3, 3, -4, 3, 1, 1
x=x, !x, !!x, -x, --x, ~x, ~~x, x?, x??
# $(x) should be: x, !x, !!x, -x, --x, ~x, ~~x, x?, x??
x=10+3, 10-3, 10*3, 10/3, 10%3, 10**3
# $(x) should be: 13, 7, 30, 3, 1, 1000
@@ -57,13 +60,10 @@ x=7 ? -1
x=0 ? -1
# $(x) should be: 0
x=1+0?0?1:2:3?4:5
# $(x) should be: 2
x=1+0?7?1:2:3?4:5
# $(x) should be: 1
x=1+1?0?1:2:3-3?4:5
x=1+0?0?1:2:3?4:5
# $(x) should be: 2
x=1-1?0?1:2:3?4:5
@@ -90,4 +90,3 @@ x=-2**2 0-2**2 0+-2**2 0--2**2
x=
y=$(x)
# <$(x)><$(y)> should be: <><>