summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/bc/Test
diff options
context:
space:
mode:
authorcgd <cgd@NetBSD.org>1993-04-10 15:51:24 +0000
committercgd <cgd@NetBSD.org>1993-04-10 15:51:24 +0000
commit439d2fb46cfec58a16c4a9856cc00ea4a2ee6de3 (patch)
treedd34836a974bf8d23a53a2773f34394576710d12 /gnu/usr.bin/bc/Test
parenta3960efdef82d52889d981e42c8e404f99470203 (diff)
gnu bc. necessary to compile the distribution
Diffstat (limited to 'gnu/usr.bin/bc/Test')
-rw-r--r--gnu/usr.bin/bc/Test/array.b14
-rw-r--r--gnu/usr.bin/bc/Test/aryprm.b16
-rw-r--r--gnu/usr.bin/bc/Test/atan.b3
-rw-r--r--gnu/usr.bin/bc/Test/checklib.b109
-rw-r--r--gnu/usr.bin/bc/Test/div.b8
-rw-r--r--gnu/usr.bin/bc/Test/exp.b3
-rw-r--r--gnu/usr.bin/bc/Test/fact.b13
-rw-r--r--gnu/usr.bin/bc/Test/jn.b6
-rw-r--r--gnu/usr.bin/bc/Test/ln.b3
-rw-r--r--gnu/usr.bin/bc/Test/mul.b7
-rw-r--r--gnu/usr.bin/bc/Test/raise.b3
-rw-r--r--gnu/usr.bin/bc/Test/sine.b3
12 files changed, 188 insertions, 0 deletions
diff --git a/gnu/usr.bin/bc/Test/array.b b/gnu/usr.bin/bc/Test/array.b
new file mode 100644
index 00000000000..a0341ec7d74
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/array.b
@@ -0,0 +1,14 @@
+"This tests arrays!
+"
+define p(x,y) {
+ auto i;
+ for (i=x; i<y; i++) a[i];
+}
+
+for (i=0; i<10; i++) a[i] = i;
+j = p(0,10);
+
+for (i=1000; i<1030; i++) a[i] = i;
+j = p(1000,1030);
+j = p(0,10);
+
diff --git a/gnu/usr.bin/bc/Test/aryprm.b b/gnu/usr.bin/bc/Test/aryprm.b
new file mode 100644
index 00000000000..9d3f95b8b8d
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/aryprm.b
@@ -0,0 +1,16 @@
+define p ( x[] ) {
+ auto i;
+ for (i=0; i<10; i++) x[i];
+}
+
+define m ( x[] ) {
+ auto i;
+ for (i=0; i<10; i++) x[i] *= 2;
+}
+
+scale = 20;
+for (i=0; i<10; i++) a[i] = sqrt(i);
+
+p(a[]);
+m(a[]);
+p(a[]);
diff --git a/gnu/usr.bin/bc/Test/atan.b b/gnu/usr.bin/bc/Test/atan.b
new file mode 100644
index 00000000000..125de319134
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/atan.b
@@ -0,0 +1,3 @@
+for (a=0; a<100; a++) x=a(a)
+x
+quit
diff --git a/gnu/usr.bin/bc/Test/checklib.b b/gnu/usr.bin/bc/Test/checklib.b
new file mode 100644
index 00000000000..88ed2723b55
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/checklib.b
@@ -0,0 +1,109 @@
+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;
+
+}
+
+
+"
+Checking e(x)"
+define f(x) {
+ return (e(x))
+}
+"
+scale = 10"
+j = t(-50,50,1,10,14)
+"
+scale = 20"
+j = t(-50,50,1,20,24)
+
+"
+Checking l(x)"
+define f(x) {
+ return (l(x))
+}
+"
+scale = 10"
+j = t(1,10000,100,10,14)
+"
+scale = 20"
+j = t(1,10000,100,20,24)
+
+"
+Checking s(x)"
+define f(x) {
+ return (s(x))
+}
+"
+scale = 10"
+j = t(0,8*a(1),.01,10,14)
+"
+scale = 20"
+j = t(1,8*a(1),.01,20,24)
+
+"
+Checking a(x)"
+define f(x) {
+ return (a(x))
+}
+"
+scale = 10"
+j = t(-100,100,1,10,14)
+"
+scale = 20"
+j = t(-100,100,1,20,24)
+
+"
+Checking j(n,x)"
+define f(x) {
+ return (j(n,x))
+}
+"
+n=0, scale=10"
+n=0
+j = t(0,30,.1,10,14)
+"
+n=1, scale=10"
+n=1
+j = t(0,30,.1,10,14)
+"
+n=0, scale=20"
+n=0
+j = t(0,30,.1,20,24)
+"
+n=1, scale=20"
+n=1
+j = t(0,30,.1,20,24)
+
diff --git a/gnu/usr.bin/bc/Test/div.b b/gnu/usr.bin/bc/Test/div.b
new file mode 100644
index 00000000000..3c7d377dca0
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/div.b
@@ -0,0 +1,8 @@
+scale = 20
+a=2/3
+for (i=0; i<1000; i++) {
+ for (j=1; j<100; j++) b=a/j
+}
+b
+quit
+
diff --git a/gnu/usr.bin/bc/Test/exp.b b/gnu/usr.bin/bc/Test/exp.b
new file mode 100644
index 00000000000..ed0e536384c
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/exp.b
@@ -0,0 +1,3 @@
+for (a=0; a<150; a++) x=e(a)
+x
+quit
diff --git a/gnu/usr.bin/bc/Test/fact.b b/gnu/usr.bin/bc/Test/fact.b
new file mode 100644
index 00000000000..8d1474702bd
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/fact.b
@@ -0,0 +1,13 @@
+define f (x) {
+
+ if (x<=1) return(1)
+ return (f(x-1)*x)
+}
+
+"Here we go"
+for (a=1; a<100; a++) b+=f(a)/a
+"
+"
+"b=";b
+quit
+
diff --git a/gnu/usr.bin/bc/Test/jn.b b/gnu/usr.bin/bc/Test/jn.b
new file mode 100644
index 00000000000..80ac915cc39
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/jn.b
@@ -0,0 +1,6 @@
+scale = 30
+for (a=0; a<5; a=a+2) {
+ for (b=0; b<100; b=b+10) x=j(a,b)
+}
+x
+quit
diff --git a/gnu/usr.bin/bc/Test/ln.b b/gnu/usr.bin/bc/Test/ln.b
new file mode 100644
index 00000000000..00a1deb7818
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/ln.b
@@ -0,0 +1,3 @@
+for (a=1; a<10000000000000000000000000000; a = a*2) x=l(a)
+x
+quit
diff --git a/gnu/usr.bin/bc/Test/mul.b b/gnu/usr.bin/bc/Test/mul.b
new file mode 100644
index 00000000000..1970ed13131
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/mul.b
@@ -0,0 +1,7 @@
+scale = 20
+for (i=0; i<1000; i++) {
+ for (j=1; j<100; j++) b=i*j
+}
+b
+quit
+
diff --git a/gnu/usr.bin/bc/Test/raise.b b/gnu/usr.bin/bc/Test/raise.b
new file mode 100644
index 00000000000..a8858151999
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/raise.b
@@ -0,0 +1,3 @@
+for (i=0; i<1000; i++) a = 2^i;
+a
+quit
diff --git a/gnu/usr.bin/bc/Test/sine.b b/gnu/usr.bin/bc/Test/sine.b
new file mode 100644
index 00000000000..8dae0b6dd89
--- /dev/null
+++ b/gnu/usr.bin/bc/Test/sine.b
@@ -0,0 +1,3 @@
+for (i=0; i<8*a(1); i=i+.01) x=s(i)
+x
+quit