Results for arith.test.sh

statusoshosh_.pyosh_.cc
pass 565453
ok 555
FAIL 023
total616161
caseoshosh_.pyosh_.ccdescription
0pass pass pass Side Effect in Array Indexing
1pass pass pass Add one to var
2pass pass pass $ is optional
3pass pass pass SimpleVarSub within arith
4pass pass pass BracedVarSub within ArithSub
5pass pass pass Arith word part
6pass FAIL FAIL Arith sub with word parts
detailsdetails
7pass pass pass Constant with quotes like '1'
8pass pass pass Arith sub within arith sub
9pass FAIL FAIL Backticks within arith sub
detailsdetails
10ok ok ok Invalid string to int
detailsdetailsdetails
11pass pass pass Invalid string to int with strict_arith
12pass pass pass Newline in the middle of expression
13pass pass pass Ternary operator
14pass pass pass Preincrement
15pass pass pass Postincrement
16pass pass pass Increment undefined variables
17pass pass pass Increment and decrement array elements
18pass pass pass Increment undefined variables with nounset
19pass pass pass Comma operator (borrowed from C)
20pass pass pass Augmented assignment
21pass pass pass Comparison Ops
22pass pass pass Logical Ops
23pass pass pass Logical Ops Short Circuit
24pass pass pass Bitwise ops
25pass pass pass Unary minus and plus
26pass pass pass No floating point
27pass pass pass Array indexing in arith
28pass pass pass Constants in base 36
29pass pass pass Constants in bases 2 to 64
30pass pass pass Multiple digit constants with base N
31pass pass pass Dynamic base constants
32pass pass pass Octal constant
33pass pass pass Dynamic octal constant
34pass pass pass Dynamic hex constants
35ok ok ok Dynamic var names - result of runtime parse/eval
detailsdetailsdetails
36ok ok ok Bizarre recursive name evaluation - result of runtime parse/eval
detailsdetailsdetails
37pass pass pass nounset with arithmetic
38pass pass FAIL Integer Overflow
details
39pass pass pass Invalid LValue
40pass pass pass Invalid LValue that looks like array
41pass pass pass Invalid LValue: two sets of brackets
42pass pass pass Operator Precedence
43pass pass pass Exponentiation with **
44pass pass pass Exponentiation operator has buggy precedence
45pass pass pass Negative exponent
46ok ok ok Comment not allowed in the middle of multiline arithmetic
detailsdetailsdetails
47pass pass pass Can't add integer to indexed array
48pass pass pass Can't add integer to associative array
49ok ok ok Double subscript
detailsdetailsdetails
50pass pass pass result of ArithSub is array
51pass pass pass result of ArithSub is assoc array
52pass pass pass comma operator
53pass pass pass assignment with dynamic var name
54pass pass pass array assignment with dynamic array name
55pass pass pass unary assignment with dynamic var name
56pass pass pass unary array assignment with dynamic var name
57pass pass pass shopt -s eval_unsafe_arith
58pass pass pass eval_unsafe_arith on empty string
59pass pass pass nested ternary (bug fix)
60pass pass pass 1 ? a=1 : b=2 ( bug fix)
163 passed, 15 OK, 0 not implemented, 0 BUG, 5 failed, 0 timeouts, 0 cases skipped

Details on runs that didn't PASS

osh_.py6 Arith sub with word parts

[osh_.py stdout] Expected '14\n', got ''
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1360, in _EvalWordPart
    num = self.arith_ev.EvalToInt(part.anode)
  File "/home/andy/git/oilshell/oil/osh/sh_expr_eval.py", line 367, in EvalToInt
    val = self.Eval(node)
  File "/home/andy/git/oilshell/oil/osh/sh_expr_eval.py", line 566, in Eval
    rhs = self.EvalToInt(node.right)
  File "/home/andy/git/oilshell/oil/osh/sh_expr_eval.py", line 367, in EvalToInt
    val = self.Eval(node)
  File "/home/andy/git/oilshell/oil/osh/sh_expr_eval.py", line 408, in Eval
    return self.word_ev.EvalWordToString(w)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1498, in EvalWordToString
    self._EvalWordPart(p, part_vals, quoted=False)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1332, in _EvalWordPart
    sv = self._EvalCommandSub(part.child, quoted) # type: part_value_t
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1959, in _EvalCommandSub
    stdout = self.shell_ex.RunCommandSub(node)
AttributeError: 'NoneType' object has no attribute 'RunCommandSub'
osh_.cc6 Arith sub with word parts

[osh_.cc stdout] Expected '14\n', got '4\n'

stdout:
4
stderr:
osh_.py9 Backticks within arith sub

[osh_.py stdout] Expected '3\n', got ''
[osh_.py status] Expected 0, got 1
[osh_.py stderr] Found 'Traceback (most recent'

stdout:
stderr: 
Traceback (most recent call last):
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 417, in <module>
    status = main(sys.argv)
  File "/home/andy/git/oilshell/oil/bin/osh_eval.py", line 309, in main
    cmd_flags=cmd_eval.IsMainProgram)
  File "/home/andy/git/oilshell/oil/core/main_loop.py", line 168, in Batch
    is_return, is_fatal = cmd_ev.ExecuteAndCatch(node, cmd_flags=cmd_flags)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1461, in ExecuteAndCatch
    status = self._Execute(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 1341, in _Execute
    status, check_errexit = self._Dispatch(node)
  File "/home/andy/git/oilshell/oil/osh/cmd_eval.py", line 547, in _Dispatch
    cmd_val = self.word_ev.EvalWordSequence2(words, allow_assign=True)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1868, in EvalWordSequence2
    self._EvalWordToParts(w, False, part_vals)  # not double quoted
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1455, in _EvalWordToParts
    self._EvalWordPart(p, part_vals, quoted=quoted, is_subst=is_subst)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1360, in _EvalWordPart
    num = self.arith_ev.EvalToInt(part.anode)
  File "/home/andy/git/oilshell/oil/osh/sh_expr_eval.py", line 367, in EvalToInt
    val = self.Eval(node)
  File "/home/andy/git/oilshell/oil/osh/sh_expr_eval.py", line 565, in Eval
    lhs = self.EvalToInt(node.left)
  File "/home/andy/git/oilshell/oil/osh/sh_expr_eval.py", line 367, in EvalToInt
    val = self.Eval(node)
  File "/home/andy/git/oilshell/oil/osh/sh_expr_eval.py", line 408, in Eval
    return self.word_ev.EvalWordToString(w)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1498, in EvalWordToString
    self._EvalWordPart(p, part_vals, quoted=False)
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1332, in _EvalWordPart
    sv = self._EvalCommandSub(part.child, quoted) # type: part_value_t
  File "/home/andy/git/oilshell/oil/osh/word_eval.py", line 1959, in _EvalCommandSub
    stdout = self.shell_ex.RunCommandSub(node)
AttributeError: 'NoneType' object has no attribute 'RunCommandSub'
osh_.cc9 Backticks within arith sub

[osh_.cc stdout] Expected '3\n', got '2\n'

stdout:
2
stderr:
osh10 Invalid string to int

stdout:
5
stderr:
osh_.py10 Invalid string to int

stdout:
5
stderr:
osh_.cc10 Invalid string to int

stdout:
5
stderr:
osh35 Dynamic var names - result of runtime parse/eval

stdout:
6
stderr:
osh_.py35 Dynamic var names - result of runtime parse/eval

stdout:
6
stderr:
osh_.cc35 Dynamic var names - result of runtime parse/eval

stdout:
6
stderr:
osh36 Bizarre recursive name evaluation - result of runtime parse/eval

stdout:
6 1 1 1
stderr:
osh_.py36 Bizarre recursive name evaluation - result of runtime parse/eval

stdout:
6 1 1 1
stderr:
osh_.cc36 Bizarre recursive name evaluation - result of runtime parse/eval

stdout:
6 1 1 1
stderr:
osh_.cc38 Integer Overflow

[osh_.cc stdout] Expected '999996000005999996000001\n', got '-15640831\n'

stdout:
-15640831
stderr:
osh46 Comment not allowed in the middle of multiline arithmetic

stdout:
6
stderr:
  1 + 2  # not a comment
          ^
[ stdin ]:7: Expected first ) to end arith sub
osh_.py46 Comment not allowed in the middle of multiline arithmetic

stdout:
6
stderr:
  1 + 2  # not a comment
          ^
[ stdin ]:7: Expected first ) to end arith sub
osh_.cc46 Comment not allowed in the middle of multiline arithmetic

stdout:
6
stderr:
  1 + 2  # not a comment
          ^
[ stdin ]:7: Expected first ) to end arith sub
osh49 Double subscript

stdout:
2
stderr:
  echo $(( a[1][1] ))
               ^
[ stdin ]:3: The [ operator doesn't apply to this expression
osh_.py49 Double subscript

stdout:
2
stderr:
  echo $(( a[1][1] ))
               ^
[ stdin ]:3: The [ operator doesn't apply to this expression
osh_.cc49 Double subscript

stdout:
2
stderr:
  echo $(( a[1][1] ))
               ^
[ stdin ]:3: The [ operator doesn't apply to this expression