From 5439ab7459283bf61a0256c3a20df164c780ef6c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Wed, 15 Nov 2000 20:19:18 +0000 Subject: Imported from /home/lorry/working-area/delta_bc-tarball/bc-1.06.tar.gz. --- Test/BUG.bc | 40 +++++++++++++++++++++ Test/array.b | 14 ++++++++ Test/arrayp.b | 30 ++++++++++++++++ Test/aryprm.b | 16 +++++++++ Test/atan.b | 5 +++ Test/checklib.b | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Test/div.b | 8 +++++ Test/exp.b | 3 ++ Test/fact.b | 12 +++++++ Test/jn.b | 6 ++++ Test/ln.b | 4 +++ Test/mul.b | 13 +++++++ Test/raise.b | 7 ++++ Test/signum | 87 ++++++++++++++++++++++++++++++++++++++++++++ Test/sine.b | 5 +++ Test/sqrt.b | 13 +++++++ Test/sqrt1.b | 13 +++++++ Test/sqrt2.b | 10 ++++++ Test/testfn.b | 47 ++++++++++++++++++++++++ Test/timetest | 16 +++++++++ 20 files changed, 458 insertions(+) create mode 100644 Test/BUG.bc create mode 100644 Test/array.b create mode 100644 Test/arrayp.b create mode 100644 Test/aryprm.b create mode 100644 Test/atan.b create mode 100644 Test/checklib.b create mode 100644 Test/div.b create mode 100644 Test/exp.b create mode 100644 Test/fact.b create mode 100644 Test/jn.b create mode 100644 Test/ln.b create mode 100644 Test/mul.b create mode 100644 Test/raise.b create mode 100644 Test/signum create mode 100644 Test/sine.b create mode 100644 Test/sqrt.b create mode 100644 Test/sqrt1.b create mode 100644 Test/sqrt2.b create mode 100644 Test/testfn.b create mode 100755 Test/timetest (limited to 'Test') diff --git a/Test/BUG.bc b/Test/BUG.bc new file mode 100644 index 0000000..254eefe --- /dev/null +++ b/Test/BUG.bc @@ -0,0 +1,40 @@ +/* <--- bug.bc ---><--- bug.bc ---><--- bug.bc ---><--- bug.bc ---> */ + +/* + * See the file "signum" for a description and reference for this + * program. + * + * THIS BUG IS *NOT* IN GNU BC!!! + * + */ + +obase=16 +ibase=16 +x=1A8F5C99605AE52 /* dividend */ +y=BB0B404 /* divisor */ +q=245A07AD /* (correct) quotient */ +r=147EB9E /* (correct) remainder */ +"Base 16 +" +"x = "; x /* output numbers just to be sure... */ +"y = "; y +"quo = "; q +"rem = "; r +"x/y = "; x/y /* watch this result! */ +"x%y = "; x%y /* watch this result! */ +"y*q+r= "; y*q+r /* check quotient & remainder */ +/* + * Do the same thing in base 10: + */ +" +Base 10 +" +ibase=A +obase=10 +"x = "; x /* output numbers just to be sure... */ +"y = "; y +"q = "; q +"r = "; r +"x/y = "; x/y /* watch this result! */ +"x%y = "; x%y /* watch this result! */ +"y*q+r= "; y*q+r /* check quotient & remainder */ diff --git a/Test/array.b b/Test/array.b new file mode 100644 index 0000000..a0341ec --- /dev/null +++ b/Test/array.b @@ -0,0 +1,14 @@ +"This tests arrays! +" +define p(x,y) { + auto i; + for (i=x; i= t) { + "Bad Scales. Try again. +"; return; + } + + for (i = x; i < y; i += d) { + scale = s; + u = f(i); + scale = t; + v = f(i); + scale = s; + w = v / 1; + b += 1; + if (u != w) { + c += 1; +" +Failed: +" + " index = "; i; + " val1 = "; u; + " val2 = "; v; +" +" + } + } + +" +Total tests: "; b; +" +Total failures: "; c; +" +Percent failed: "; scale = 2; c*100/b; + +} + +/* + b = begining scale value, + l = limit scale value, + i = increment scale value. + + if b is set to a non-zero value before this file is executed, + b, l and i are not reset. +*/ + +if (b == 0) { b = 10; l = 61; i = 10; } + +" +Checking e(x)" +define f(x) { + return (e(x)) +} +for (s=10; ss. + the result from scale t is divided by 1 at scale s and the + results are compared. If they are different, the function is + said to have failed. It will then print out the value of i + (called index) and the two original values val1 (scale s) and + val2 (scale t) */ + +define t (x,y,d,s,t) { + auto u, v, w, i, b, c; + + if (s >= t) { + "Bad Scales. Try again. +"; return; + } + + for (i = x; i < y; i += d) { + scale = s; + u = f(i); + scale = t; + v = f(i); + scale = s; + w = v / 1; + b += 1; + if (u != w) { + c += 1; +" +Failed: +" + " index = "; i; + " val1 = "; u; + " val2 = "; v; +" +" + } + } + +" +Total tests: "; b; +" +Total failures: "; c; +" +Percent failed: "; scale = 2; c*100/b; + +} diff --git a/Test/timetest b/Test/timetest new file mode 100755 index 0000000..1a4d0ea --- /dev/null +++ b/Test/timetest @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Time the functions. +# +SYSBC=/usr/bin/bc +if [ x$BC = x ] ; then + BC=../bc/bc +fi +for file in exp.b ln.b sine.b atan.b jn.b mul.b div.b raise.b sqrt.b +do +for prog in $BC $SYSBC $OTHERBC +do +echo Timing $file with $prog +time $prog -l $file +done +done -- cgit v1.2.1