tests/bc: Add test cases for the bc library - sbase - suckless unix tools
HTML git clone git://git.suckless.org/sbase
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 325953bd2cd1e1fd43a8cf8f9e1b49c32e5b818b
DIR parent 1106076d535f8c9e93694a0343e5508865df9a4b
HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 12 Dec 2025 20:34:56 +0100
tests/bc: Add test cases for the bc library
These tests cover a big portion of the code because they
execute complex functions suing many of the features of
bc.
Diffstat:
A tests/0010-bc.sh | 39 +++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+), 0 deletions(-)
---
DIR diff --git a/tests/0010-bc.sh b/tests/0010-bc.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+tmp=$$.tmp
+
+trap 'rm -f $tmp' EXIT
+trap 'rm -f $tmp; kill -KILL $$' HUP INT TERM
+
+cat <<EOF >$tmp
+0
+.78539816339744830961
+1.10714871779409050301
+.73281510178650659163
+-.73281510178650659163
+0.00000000000000000000
+.70710678118654752439
+.00000000000000000002
+.19866933079506121545
+-.98006657784124163112
+.99999998953050228773
+1.99999999999999999999
+.48609126058589107690
+EOF
+
+../bc ../bc.library <<EOF | diff -u $tmp -
+a(0)
+a(1)
+a(2)
+a(0.9)
+a(-0.9)
+s(0)
+s(a(1))
+s(4*a(1))
+s(0.2)
+c(0.2 + 4*a(1))
+l(2.7182818)
+l(e(2))
+j(2,3)
+quit
+EOF