about summary refs log tree commit diff
path: root/Test/C01arith.ztst
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2018-05-13 10:13:42 +0200
committerOliver Kiddle <okiddle@yahoo.co.uk>2018-05-13 10:13:42 +0200
commita93abe1170a438d45d94b3a7f924553f5cf69cee (patch)
tree95cc9a6832acc5ece693389209531eeefdc10f88 /Test/C01arith.ztst
parent373efa085dcea5fe6b4539cd875b6bd8645f16fa (diff)
downloadzsh-a93abe1170a438d45d94b3a7f924553f5cf69cee.tar.gz
zsh-a93abe1170a438d45d94b3a7f924553f5cf69cee.tar.xz
zsh-a93abe1170a438d45d94b3a7f924553f5cf69cee.zip
42488: test cases for 42369 and address some issues in the code
Diffstat (limited to 'Test/C01arith.ztst')
-rw-r--r--Test/C01arith.ztst34
1 files changed, 34 insertions, 0 deletions
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index 30409adf3..77a46ebd5 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -302,6 +302,40 @@
 ?(eval):1: bad math expression: operator expected at `2 '
 # ` for emacs shell mode
 
+  in=1 info=2 Infinity=3 Inf=4
+  print $(( in )) $(( info )) $(( Infinity )) $(( $Inf )) $(( inf )) $(( INF )) $(( Inf )) $(( iNF ))
+0:Infinity parsing
+>1 2 3 4 Inf Inf Inf Inf
+
+  integer Inf
+  print $(( Inf[0] ))
+1:Refer to Inf with an array subscript
+?(eval):2: bad base syntax
+
+  (( NaN = 1 ))
+2:Assign to NaN
+?(eval):1: bad math expression: lvalue required
+
+  a='Inf'
+  (( b = 1e500 ))
+  print $((1e500)) $(($((1e500)))) $(( a )) $b $(( b )) $(( 3.0 / 0 ))
+0:Overflow to infinity
+>Inf Inf Inf Inf Inf Inf
+
+  print $((1e500))
+  print $(( $((1e500)) ))
+0:Reinput infinity value into math context
+>Inf
+>Inf
+
+  print $((1e500/1e500)) $((-1e500/1e500)) $(( 24. % 0 ))
+0:NaN results
+>NaN NaN NaN
+
+  (( 3 / 0 ))
+2:Integer division by zero
+?(eval):1: division by zero
+
   integer varassi
   print $(( varassi = 5.5 / 2.0 ))
   print $varassi