Add a test for a bug I found while writing a script

This bug is complicated, but it is caused when an element from an array
is passed as a parameter, and then a later parameter is named the same
as the array whose element was passed in.

I still don't know how to solve it, but this test fails properly while
the bug still exists.

Signed-off-by: Gavin Howard <[email protected]>
This commit is contained in:
Gavin Howard 2022-12-27 22:48:32 -07:00
parent 21d20454d4
commit 78bc9d0c74
Signed by: gavin
GPG Key ID: 93D31C8CA4AB6C63
4 changed files with 30 additions and 0 deletions

View File

@ -2496,6 +2496,13 @@ array.bc
: Tests arrays even harder than the arrays standard test.
array2.bc
: Implements a test where an array element is passed as a parameter to a
function, and then another array is passed to a later parameter that is
named the same as the first array. This was added because of a bug found
while writing a script in bc.
atan.bc
: Tests arctangent even harder than the arctangent standard test.

View File

@ -5,6 +5,7 @@ add.bc
print.bc
parse.bc
array.bc
array2.bc
atan.bc
bessel.bc
functions.bc

View File

@ -0,0 +1,20 @@
#! /usr/bin/bc -q
define z(x, a[]) {
return x + a[1]
}
define y(x, b[]) {
return x + b[1]
}
a[0] = 5
a[1] = 6
b[0] = 8
b[1] = 7
z(a[0], b[])
y(b[0], a[])
halt

View File

@ -0,0 +1,2 @@
12
14