2021-01-31 19:56:48 +00:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
#
|
2023-01-28 20:02:27 +00:00
|
|
|
# Copyright (c) 2018-2023 Gavin D. Howard and contributors.
|
2021-01-31 19:56:48 +00:00
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright notice, this
|
|
|
|
# list of conditions and the following disclaimer.
|
|
|
|
#
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions and the following disclaimer in the documentation
|
|
|
|
# and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
script="$0"
|
|
|
|
testdir=$(dirname "$script")
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
. "$testdir/../scripts/functions.sh"
|
|
|
|
|
2021-09-19 12:41:20 +00:00
|
|
|
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
|
|
|
|
|
2023-02-06 21:33:56 +00:00
|
|
|
# Just print the usage and exit with an error. This can receive a message to
|
|
|
|
# print.
|
|
|
|
# @param 1 A message to print.
|
|
|
|
usage() {
|
|
|
|
if [ $# -eq 1 ]; then
|
|
|
|
printf '%s\n\n' "$1"
|
|
|
|
fi
|
|
|
|
printf 'usage: %s dir extra_math [exec args...]\n' "$script"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
# Command-line processing.
|
|
|
|
if [ "$#" -ge 2 ]; then
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
d="$1"
|
|
|
|
shift
|
2023-02-06 21:33:56 +00:00
|
|
|
check_d_arg "$d"
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
|
|
|
extra_math="$1"
|
|
|
|
shift
|
2023-02-06 21:33:56 +00:00
|
|
|
check_bool_arg "$extra_math"
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
2021-01-31 19:56:48 +00:00
|
|
|
else
|
2023-02-06 21:33:56 +00:00
|
|
|
usage "Not enough arguments; need 2"
|
2021-01-31 19:56:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$#" -lt 1 ]; then
|
|
|
|
exe="$testdir/../bin/$d"
|
2023-02-06 21:33:56 +00:00
|
|
|
check_exec_arg "$exe"
|
2021-01-31 19:56:48 +00:00
|
|
|
else
|
|
|
|
exe="$1"
|
|
|
|
shift
|
2023-02-06 21:33:56 +00:00
|
|
|
check_exec_arg "$exe"
|
2021-01-31 19:56:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$d" = "bc" ]; then
|
|
|
|
halt="quit"
|
|
|
|
else
|
|
|
|
halt="q"
|
|
|
|
fi
|
|
|
|
|
2022-06-11 09:50:28 +00:00
|
|
|
mkdir -p "$outputdir"
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
# For tests later.
|
2021-01-31 19:56:48 +00:00
|
|
|
num=100000000000000000000000000000000000000000000000000000000000000000000000000000
|
2021-10-04 19:22:35 +00:00
|
|
|
num2="$num"
|
2021-01-31 19:56:48 +00:00
|
|
|
numres="$num"
|
|
|
|
num70="10000000000000000000000000000000000000000000000000000000000000000000\\
|
|
|
|
0000000000"
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
# Set stuff for the correct calculator.
|
2021-01-31 19:56:48 +00:00
|
|
|
if [ "$d" = "bc" ]; then
|
|
|
|
halt="halt"
|
|
|
|
opt="x"
|
|
|
|
lopt="extended-register"
|
|
|
|
line_var="BC_LINE_LENGTH"
|
2021-10-04 19:22:35 +00:00
|
|
|
lltest="line_length()"
|
2021-01-31 19:56:48 +00:00
|
|
|
else
|
|
|
|
halt="q"
|
|
|
|
opt="l"
|
|
|
|
lopt="mathlib"
|
|
|
|
line_var="DC_LINE_LENGTH"
|
|
|
|
num="$num pR"
|
2021-10-04 19:22:35 +00:00
|
|
|
lltest="glpR"
|
2021-01-31 19:56:48 +00:00
|
|
|
fi
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
# I use these, so unset them to make the tests work.
|
|
|
|
unset BC_ENV_ARGS
|
|
|
|
unset BC_LINE_LENGTH
|
|
|
|
unset DC_ENV_ARGS
|
|
|
|
unset DC_LINE_LENGTH
|
|
|
|
|
2021-01-31 19:56:48 +00:00
|
|
|
set +e
|
|
|
|
|
|
|
|
printf '\nRunning %s quit test...' "$d"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" > /dev/null 2>&1
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
checktest_retcode "$d" "$?" "quit"
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
# bc has two halt or quit commands, so test the second as well.
|
2021-01-31 19:56:48 +00:00
|
|
|
if [ "$d" = bc ]; then
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "quit" 2> /dev/null | "$exe" "$@" > /dev/null 2>&1
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
checktest_retcode "$d" "$?" quit
|
|
|
|
|
|
|
|
two=$("$exe" "$@" -e 1+1 -e quit)
|
|
|
|
|
|
|
|
checktest_retcode "$d" "$?" quit
|
|
|
|
|
|
|
|
if [ "$two" != "2" ]; then
|
|
|
|
err_exit "$d failed test quit" 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
|
|
|
|
base=$(basename "$exe")
|
|
|
|
|
|
|
|
printf 'Running %s environment var tests...' "$d"
|
|
|
|
|
|
|
|
if [ "$d" = "bc" ]; then
|
|
|
|
|
|
|
|
export BC_ENV_ARGS=" '-l' '' -q"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 's(.02893)\n' 2> /dev/null | "$exe" "$@" > /dev/null
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
checktest_retcode "$d" "$?" "environment var"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'halt\n' 2> /dev/null | "$exe" "$@" -e 4 > /dev/null
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
err="$?"
|
|
|
|
checktest_retcode "$d" "$?" "environment var"
|
2021-04-06 08:44:52 +00:00
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
printf 'Running keyword redefinition test...'
|
|
|
|
|
|
|
|
unset BC_ENV_ARGS
|
|
|
|
|
2021-09-19 12:41:20 +00:00
|
|
|
redefine_res="$outputdir/bc_outputs/redefine.txt"
|
|
|
|
redefine_out="$outputdir/bc_outputs/redefine_results.txt"
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
2022-06-11 09:50:28 +00:00
|
|
|
outdir=$(dirname "$redefine_out")
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
|
|
|
if [ ! -d "$outdir" ]; then
|
|
|
|
mkdir -p "$outdir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf '5\n0\n' > "$redefine_res"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'halt\n' 2> /dev/null | "$exe" "$@" --redefine=print -e 'define print(x) { x }' -e 'print(5)' > "$redefine_out"
|
2022-03-07 22:08:20 +00:00
|
|
|
err="$?"
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
|
|
|
checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'halt\n' 2> /dev/null | "$exe" "$@" -r "abs" -r "else" -e 'abs = 5;else = 0' -e 'abs;else' > "$redefine_out"
|
2022-03-07 22:08:20 +00:00
|
|
|
err="$?"
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
|
|
|
checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out"
|
|
|
|
|
|
|
|
if [ "$extra_math" -ne 0 ]; then
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'halt\n' 2> /dev/null | "$exe" "$@" -lr abs -e "perm(5, 1)" -e "0" > "$redefine_out"
|
2022-03-07 22:08:20 +00:00
|
|
|
err="$?"
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
|
|
|
checktest "$d" "$err" "keyword not redefined in builtin library" "$redefine_res" "$redefine_out"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
"$exe" "$@" -r "break" -e 'define break(x) { x }' 2> "$redefine_out"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "keyword redefinition error" "$redefine_out" "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" -e 'define read(x) { x }' 2> "$redefine_out"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "Keyword redefinition error without BC_REDEFINE_KEYWORDS" "$redefine_out" "$d"
|
|
|
|
|
|
|
|
printf 'pass\n'
|
2022-03-07 22:08:20 +00:00
|
|
|
printf 'Running multiline comment expression file test...'
|
|
|
|
|
|
|
|
multiline_expr_res=""
|
|
|
|
multiline_expr_out="$outputdir/bc_outputs/multiline_expr_results.txt"
|
|
|
|
|
|
|
|
# tests/bc/misc1.txt happens to have a multiline comment in it.
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/misc1.txt" > "$multiline_expr_out"
|
2022-03-07 22:08:20 +00:00
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checktest "$d" "$err" "multiline comment in expression file" "$testdir/bc/misc1_results.txt" \
|
|
|
|
"$multiline_expr_out"
|
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
printf 'Running multiline comment expression file error test...'
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/errors/05.txt" 2> "$multiline_expr_out"
|
2022-03-07 22:08:20 +00:00
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "multiline comment in expression file error" \
|
|
|
|
"$multiline_expr_out" "$d"
|
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
printf 'Running multiline string expression file test...'
|
|
|
|
|
|
|
|
# tests/bc/strings.txt happens to have a multiline string in it.
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/strings.txt" > "$multiline_expr_out"
|
2022-03-07 22:08:20 +00:00
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checktest "$d" "$err" "multiline string in expression file" "$testdir/bc/strings_results.txt" \
|
|
|
|
"$multiline_expr_out"
|
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
printf 'Running multiline string expression file error test...'
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/errors/16.txt" 2> "$multiline_expr_out"
|
2022-03-07 22:08:20 +00:00
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "multiline string in expression file with backslash error" \
|
|
|
|
"$multiline_expr_out" "$d"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/errors/04.txt" 2> "$multiline_expr_out"
|
2022-03-07 22:08:20 +00:00
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "multiline string in expression file error" \
|
|
|
|
"$multiline_expr_out" "$d"
|
|
|
|
|
|
|
|
printf 'pass\n'
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
|
2021-01-31 19:56:48 +00:00
|
|
|
else
|
|
|
|
|
|
|
|
export DC_ENV_ARGS="'-x'"
|
|
|
|
export DC_EXPR_EXIT="1"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '4s stuff\n' 2> /dev/null | "$exe" "$@" > /dev/null
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
checktest_retcode "$d" "$?" "environment var"
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
"$exe" "$@" -e 4pR > /dev/null
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
checktest_retcode "$d" "$?" "environment var"
|
|
|
|
|
2021-04-06 08:44:52 +00:00
|
|
|
printf 'pass\n'
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
# dc has an extra test for a case that someone found running this easter.dc
|
|
|
|
# script. It went into an infinite loop, so we want to check that we did not
|
|
|
|
# regress.
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'three\n' 2> /dev/null | cut -c1-3 > /dev/null
|
2021-04-06 08:44:52 +00:00
|
|
|
err=$?
|
|
|
|
|
|
|
|
if [ "$err" -eq 0 ]; then
|
|
|
|
|
|
|
|
printf 'Running dc Easter script...'
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
easter_out="$outputdir/dc_outputs/easter.txt"
|
|
|
|
easter_res="$outputdir/dc_outputs/easter_results.txt"
|
2021-04-06 08:44:52 +00:00
|
|
|
|
|
|
|
outdir=$(dirname "$easter_out")
|
|
|
|
|
|
|
|
if [ ! -d "$outdir" ]; then
|
|
|
|
mkdir -p "$outdir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf '4 April 2021\n' > "$easter_res"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
"$testdir/dc/scripts/easter.sh" "$exe" 2021 "$@" 2> /dev/null | cut -c1-12 > "$easter_out"
|
2021-04-06 08:44:52 +00:00
|
|
|
err="$?"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
checktest "$d" "$err" "Easter script" "$easter_out" "$easter_res"
|
2021-04-06 08:44:52 +00:00
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
fi
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
unset DC_ENV_ARGS
|
|
|
|
unset DC_EXPR_EXIT
|
|
|
|
|
|
|
|
printf 'Running dc extended register command tests...'
|
|
|
|
|
|
|
|
ext_reg_out="$outputdir/dc_outputs/ext_reg.txt"
|
|
|
|
ext_reg_res="$outputdir/dc_outputs/ext_reg_results.txt"
|
|
|
|
|
|
|
|
outdir=$(dirname "$ext_reg_out")
|
|
|
|
|
|
|
|
if [ ! -d "$outdir" ]; then
|
|
|
|
mkdir -p "$outdir"
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf '0\n' > "$ext_reg_res"
|
|
|
|
|
|
|
|
"$exe" "$@" -e "gxpR" 2> /dev/null > "$ext_reg_out"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checktest "$d" "$err" "Extended register command" "$ext_reg_out" "$ext_reg_res"
|
|
|
|
|
|
|
|
printf '1\n' > "$ext_reg_res"
|
|
|
|
|
|
|
|
"$exe" "$@" -x -e "gxpR" 2> /dev/null > "$ext_reg_out"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checktest "$d" "$err" "Extended register command" "$ext_reg_out" "$ext_reg_res"
|
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
|
2021-04-06 08:44:52 +00:00
|
|
|
fi
|
2021-01-31 19:56:48 +00:00
|
|
|
|
2021-09-19 12:41:20 +00:00
|
|
|
out1="$outputdir/${d}_outputs/${d}_other.txt"
|
|
|
|
out2="$outputdir/${d}_outputs/${d}_other_test.txt"
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
printf 'Running %s line length tests...' "$d"
|
|
|
|
|
|
|
|
printf '%s\n' "$numres" > "$out1"
|
|
|
|
|
|
|
|
export "$line_var"=80
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$num" 2> /dev/null | "$exe" "$@" > "$out2"
|
2021-01-31 19:56:48 +00:00
|
|
|
|
2021-10-04 19:22:35 +00:00
|
|
|
checktest "$d" "$?" "line length" "$out1" "$out2"
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
printf '%s\n' "$num70" > "$out1"
|
|
|
|
|
|
|
|
export "$line_var"=2147483647
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$num" 2> /dev/null | "$exe" "$@" > "$out2"
|
2021-01-31 19:56:48 +00:00
|
|
|
|
2021-10-04 19:22:35 +00:00
|
|
|
checktest "$d" "$?" "line length 2" "$out1" "$out2"
|
|
|
|
|
|
|
|
printf '%s\n' "$num2" > "$out1"
|
|
|
|
|
|
|
|
export "$line_var"=62
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$num" 2> /dev/null | "$exe" "$@" -L > "$out2"
|
2021-10-04 19:22:35 +00:00
|
|
|
|
|
|
|
checktest "$d" "$?" "line length 3" "$out1" "$out2"
|
|
|
|
|
|
|
|
printf '0\n' > "$out1"
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$lltest" 2> /dev/null | "$exe" "$@" -L > "$out2"
|
2021-10-04 19:22:35 +00:00
|
|
|
|
|
|
|
checktest "$d" "$?" "line length 3" "$out1" "$out2"
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
|
2021-10-04 19:22:35 +00:00
|
|
|
printf '%s\n' "$numres" > "$out1"
|
|
|
|
export "$line_var"=2147483647
|
|
|
|
|
2021-01-31 19:56:48 +00:00
|
|
|
printf 'Running %s arg tests...' "$d"
|
|
|
|
|
|
|
|
f="$testdir/$d/add.txt"
|
|
|
|
exprs=$(cat "$f")
|
|
|
|
results=$(cat "$testdir/$d/add_results.txt")
|
|
|
|
|
|
|
|
printf '%s\n%s\n%s\n%s\n' "$results" "$results" "$results" "$results" > "$out1"
|
|
|
|
|
|
|
|
"$exe" "$@" -e "$exprs" -f "$f" --expression "$exprs" --file "$f" -e "$halt" > "$out2"
|
|
|
|
|
|
|
|
checktest "$d" "$?" "arg" "$out1" "$out2"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -- "$f" "$f" "$f" "$f" > "$out2"
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
checktest "$d" "$?" "arg" "$out1" "$out2"
|
|
|
|
|
|
|
|
if [ "$d" = "bc" ]; then
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -i > /dev/null 2>&1
|
2021-01-31 19:56:48 +00:00
|
|
|
fi
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -h > /dev/null
|
2021-01-31 19:56:48 +00:00
|
|
|
checktest_retcode "$d" "$?" "arg"
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -P > /dev/null
|
2021-01-31 19:56:48 +00:00
|
|
|
checktest_retcode "$d" "$?" "arg"
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -R > /dev/null
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
checktest_retcode "$d" "$?" "arg"
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -v > /dev/null
|
2021-01-31 19:56:48 +00:00
|
|
|
checktest_retcode "$d" "$?" "arg"
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -V > /dev/null
|
2021-01-31 19:56:48 +00:00
|
|
|
checktest_retcode "$d" "$?" "arg"
|
|
|
|
|
2021-10-04 19:22:35 +00:00
|
|
|
out=$(printf '0.1\n-0.1\n1.1\n-1.1\n0.1\n-0.1\n')
|
|
|
|
printf '%s\n' "$out" > "$out1"
|
|
|
|
|
|
|
|
if [ "$d" = "bc" ]; then
|
|
|
|
data=$(printf '0.1\n-0.1\n1.1\n-1.1\n.1\n-.1\n')
|
|
|
|
else
|
|
|
|
data=$(printf '0.1pR\n_0.1pR\n1.1pR\n_1.1pR\n.1pR\n_.1pR\n')
|
|
|
|
fi
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" -z > "$out2"
|
2021-10-04 19:22:35 +00:00
|
|
|
checktest "$d" "$?" "leading zero" "$out1" "$out2"
|
|
|
|
|
|
|
|
if [ "$d" = "bc" ] && [ "$extra_math" -ne 0 ]; then
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -lz "$testdir/bc/leadingzero.txt" > "$out2"
|
2021-10-04 19:22:35 +00:00
|
|
|
|
|
|
|
checktest "$d" "$?" "leading zero script" "$testdir/bc/leadingzero_results.txt" "$out2"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2021-01-31 19:56:48 +00:00
|
|
|
"$exe" "$@" -f "saotehasotnehasthistohntnsahxstnhalcrgxgrlpyasxtsaosysxsatnhoy.txt" > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "invalid file argument" "$out2" "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" "-$opt" -e "$exprs" > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "invalid option argument" "$out2" "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" "--$lopt" -e "$exprs" > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "invalid long option argument" "$out2" "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" "-u" -e "$exprs" > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "unrecognized option argument" "$out2" "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" "--uniform" -e "$exprs" > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "unrecognized long option argument" "$out2" "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" -f > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "missing required argument to short option" "$out2" "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" --file > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "missing required argument to long option" "$out2" "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" --version=5 > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "given argument to long option with no argument" "$out2" "$d"
|
|
|
|
|
vendor/bc: imoport release 5.0.0
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
2021-08-09 20:32:55 +00:00
|
|
|
"$exe" "$@" -: > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "colon short option" "$out2" "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" --: > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "colon long option" "$out2" "$d"
|
|
|
|
|
2021-01-31 19:56:48 +00:00
|
|
|
printf 'pass\n'
|
|
|
|
|
2022-06-11 09:50:28 +00:00
|
|
|
printf 'Running %s builtin variable arg tests...' "$d"
|
|
|
|
|
|
|
|
if [ "$extra_math" -ne 0 ]; then
|
|
|
|
|
|
|
|
out=$(printf '14\n15\n16\n17.25\n')
|
|
|
|
printf '%s\n' "$out" > "$out1"
|
|
|
|
|
|
|
|
if [ "$d" = "bc" ]; then
|
|
|
|
data=$(printf 's=scale;i=ibase;o=obase;t=seed@2;ibase=A;obase=A;s;i;o;t;')
|
|
|
|
else
|
|
|
|
data=$(printf 'J2@OIKAiAopRpRpRpR')
|
|
|
|
fi
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" -S14 -I15 -O16 -E17.25 > "$out2"
|
2022-06-11 09:50:28 +00:00
|
|
|
checktest "$d" "$?" "builtin variable args" "$out1" "$out2"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" --scale=14 --ibase=15 --obase=16 --seed=17.25 > "$out2"
|
2022-06-11 09:50:28 +00:00
|
|
|
checktest "$d" "$?" "builtin variable long args" "$out1" "$out2"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
out=$(printf '14\n15\n16\n')
|
|
|
|
printf '%s\n' "$out" > "$out1"
|
|
|
|
|
|
|
|
if [ "$d" = "bc" ]; then
|
|
|
|
data=$(printf 's=scale;i=ibase;o=obase;ibase=A;obase=A;s;i;o;')
|
|
|
|
else
|
|
|
|
data=$(printf 'OIKAiAopRpRpR')
|
|
|
|
fi
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" -S14 -I15 -O16 > "$out2"
|
2022-06-11 09:50:28 +00:00
|
|
|
checktest "$d" "$?" "builtin variable args" "$out1" "$out2"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" --scale=14 --ibase=15 --obase=16 > "$out2"
|
2022-06-11 09:50:28 +00:00
|
|
|
checktest "$d" "$?" "builtin variable long args" "$out1" "$out2"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2022-08-30 18:35:22 +00:00
|
|
|
if [ "$d" = "bc" ]; then
|
|
|
|
|
|
|
|
out=$(printf '100\n')
|
|
|
|
printf '%s\n' "$out" > "$out1"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'scale\n' 2> /dev/null | "$exe" "$@" -S100 -l > "$out2"
|
2022-08-30 18:35:22 +00:00
|
|
|
checktest "$d" "$?" "builtin variable args with math lib" "$out1" "$out2"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'scale\n' 2> /dev/null | "$exe" "$@" --scale=100 --mathlib > "$out2"
|
2022-08-30 18:35:22 +00:00
|
|
|
checktest "$d" "$?" "builtin variable long args with math lib" "$out1" "$out2"
|
|
|
|
|
|
|
|
export BC_ENV_ARGS="-l"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'scale\n' 2> /dev/null | "$exe" "$@" -S100 > "$out2"
|
2022-08-30 18:35:22 +00:00
|
|
|
checktest "$d" "$?" "builtin variable args with math lib env arg" "$out1" "$out2"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'scale\n' 2> /dev/null | "$exe" "$@" --scale=100 > "$out2"
|
2022-08-30 18:35:22 +00:00
|
|
|
checktest "$d" "$?" "builtin variable long args with math lib env arg" "$out1" "$out2"
|
|
|
|
|
|
|
|
export BC_ENV_ARGS="-S100"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'scale\n' 2> /dev/null | "$exe" "$@" -l > "$out2"
|
2022-08-30 18:35:22 +00:00
|
|
|
checktest "$d" "$?" "builtin variable args with math lib arg" "$out1" "$out2"
|
|
|
|
|
|
|
|
export BC_ENV_ARGS="--scale=100"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'scale\n' 2> /dev/null | "$exe" "$@" -l > "$out2"
|
2022-08-30 18:35:22 +00:00
|
|
|
checktest "$d" "$?" "builtin variable long args with math lib arg" "$out1" "$out2"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'scale\n' 2> /dev/null | "$exe" "$@" --scale=18923c.rlg > /dev/null 2> "$out2"
|
2022-06-11 09:50:28 +00:00
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "invalid command-line arg for builtin variable" "$out2" "$d"
|
|
|
|
|
|
|
|
if [ "$extra_math" -ne 0 ]; then
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'seed\n' 2> /dev/null | "$exe" "$@" --seed=18923c.rlg > /dev/null 2> "$out2"
|
2022-06-11 09:50:28 +00:00
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "invalid command-line arg for seed" "$out2" "$d"
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
|
2021-01-31 19:56:48 +00:00
|
|
|
printf 'Running %s directory test...' "$d"
|
|
|
|
|
|
|
|
"$exe" "$@" "$testdir" > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "directory" "$out2" "$d"
|
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
|
|
|
|
printf 'Running %s binary file test...' "$d"
|
|
|
|
|
|
|
|
bin="/bin/sh"
|
|
|
|
|
|
|
|
"$exe" "$@" "$bin" > /dev/null 2> "$out2"
|
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "binary file" "$out2" "$d"
|
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
|
|
|
|
printf 'Running %s binary stdin test...' "$d"
|
|
|
|
|
2023-02-24 22:14:58 +00:00
|
|
|
cat "$bin" 2> /dev/null | "$exe" "$@" > /dev/null 2> "$out2"
|
2021-01-31 19:56:48 +00:00
|
|
|
err="$?"
|
|
|
|
|
|
|
|
checkerrtest "$d" "$err" "binary stdin" "$out2" "$d"
|
|
|
|
|
|
|
|
printf 'pass\n'
|
|
|
|
|
|
|
|
if [ "$d" = "bc" ]; then
|
|
|
|
|
|
|
|
printf 'Running %s limits tests...' "$d"
|
2023-02-24 22:14:58 +00:00
|
|
|
printf 'limits\n' 2> /dev/null | "$exe" "$@" /dev/null > "$out2" 2>&1
|
2021-01-31 19:56:48 +00:00
|
|
|
|
|
|
|
checktest_retcode "$d" "$?" "limits"
|
|
|
|
|
|
|
|
if [ ! -s "$out2" ]; then
|
|
|
|
err_exit "$d did not produce output on the limits test" 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec printf 'pass\n'
|
|
|
|
|
|
|
|
fi
|