Added RCS id.
Adapted to use the NOFLOAT cpp flag.
This commit is contained in:
parent
a1c2dadb2a
commit
04e454d3c6
|
@ -17,13 +17,18 @@
|
|||
|
||||
/* Author: E.G. Keizer */
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
main() {
|
||||
t1() ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
t1() {
|
||||
char c ; int i ; long l ; unsigned u ; float f ;
|
||||
char c ; int i ; long l ; unsigned u ;
|
||||
#ifndef NOFLOAT
|
||||
float f ;
|
||||
#endif
|
||||
|
||||
/* test conversions */
|
||||
|
||||
|
@ -31,8 +36,10 @@ t1() {
|
|||
|
||||
printf("(int) '\\377' = %d\n",(int) '\377') ;
|
||||
printf("(long) -1 = %ld\n",(long) -1 ) ;
|
||||
#ifndef NOFLOAT
|
||||
printf("(float) 12 = %f\n",(float) 12 ) ;
|
||||
printf("(int) 3.14 = %d\n",(int) 3.14 ) ;
|
||||
#endif
|
||||
printf("(int) 32767L = %d\n",(int) 32767L ) ;
|
||||
printf("(int) -32768L = %d\n",(int) -32768L ) ;
|
||||
printf("(char) 128L = %d\n",(char) 128L) ;
|
||||
|
@ -46,20 +53,35 @@ t1() {
|
|||
i=c ;
|
||||
l=c ;
|
||||
u=c ;
|
||||
#ifndef NOFLOAT
|
||||
f=c ;
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld, float %f\n",c,i,u,l,f) ;
|
||||
#endif
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
|
||||
#ifndef NOFLOAT
|
||||
printf("\t\t\t\t\tfloat %f\n",f) ;
|
||||
#endif
|
||||
c = -1 ;
|
||||
i=c ;
|
||||
l=c ;
|
||||
u=c ;
|
||||
#ifndef NOFLOAT
|
||||
f=c ;
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld, float %f\n",c,i,u,l,f) ;
|
||||
#endif
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
|
||||
#ifndef NOFLOAT
|
||||
printf("\t\t\t\t\tfloat %f\n",f) ;
|
||||
#endif
|
||||
c = 0377 ;
|
||||
i=c ;
|
||||
l=c ;
|
||||
u=c ;
|
||||
#ifndef NOFLOAT
|
||||
f=c ;
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld, float %f\n",c,i,u,l,f) ;
|
||||
#endif
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
|
||||
#ifndef NOFLOAT
|
||||
printf("\t\t\t\t\tfloat %f\n",f) ;
|
||||
#endif
|
||||
|
||||
/* from integer */
|
||||
printf("From integer\n") ;
|
||||
|
@ -67,18 +89,28 @@ t1() {
|
|||
c=i ;
|
||||
l=i ;
|
||||
u=i ;
|
||||
#ifndef NOFLOAT
|
||||
f=i ;
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld, float %f\n",c,i,u,l,f) ;
|
||||
|
||||
#endif
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
|
||||
#ifndef NOFLOAT
|
||||
printf("\t\t\t\t\tfloat %f\n",f) ;
|
||||
#endif
|
||||
/* from long */
|
||||
printf("From long\n") ;
|
||||
l = -3 ;
|
||||
c = l ;
|
||||
i = l ;
|
||||
u = l ;
|
||||
#ifndef NOFLOAT
|
||||
f = l ;
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld, float %f\n",c,i,u,l,f) ;
|
||||
#endif
|
||||
printf("\tchar %5d, int %6d, unsigned %6o, long %11ld\n",c,i,u,l) ;
|
||||
#ifndef NOFLOAT
|
||||
printf("\t\t\t\t\tfloat %f\n",f) ;
|
||||
#endif
|
||||
|
||||
#ifndef NOFLOAT
|
||||
printf("From float\n") ;
|
||||
f = 121.5 ;
|
||||
c = f ;
|
||||
|
@ -100,6 +132,7 @@ t1() {
|
|||
f = 1223432e3 ;
|
||||
l = f ;
|
||||
printf("\tlong %11ld, float %f\n",l,f) ;
|
||||
#endif
|
||||
|
||||
/* some special cases */
|
||||
{
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
/* Author: E.G. Keizer */
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
/* Test a few declaration features */
|
||||
/* Such as:
|
||||
forward function declarations,
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
/* Author: E.G. Keizer */
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
main() {
|
||||
|
||||
assnull() ;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
/* Author: E.G. Keizer */
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
/* This programs is a collection of derived from small tests develloped
|
||||
for specific bugs/features in the C->EM compiler
|
||||
*/
|
||||
|
@ -69,12 +71,16 @@ loc_fa(p1,p2) {
|
|||
|
||||
con_fold() {
|
||||
set_err("con_fold") ;
|
||||
#ifndef NOFLOAT
|
||||
con_flo( (1 ? 3 : 4.5), 200, 200, 200 ) ;
|
||||
#endif
|
||||
con_lo( 4L + 3, 1 ) ;
|
||||
}
|
||||
#ifndef NOFLOAT
|
||||
con_flo(d) double d ; {
|
||||
if ( d>3.00001 || d<2.99999 ) e(1) ;
|
||||
}
|
||||
#endif
|
||||
con_lo(l) long l ; {
|
||||
if ( l!=7 ) e(2) ;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -16,6 +16,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
|
||||
/*
|
||||
#define TEST1 1
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
/* This program can be used to test C-compilers */
|
||||
|
||||
|
||||
|
|
|
@ -15,12 +15,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
/* This program can be used to test C-compilers */
|
||||
|
||||
int i,j,k,l,m,ect,pct,t,*p1;
|
||||
int a1[20];
|
||||
#ifndef NOFLOAT
|
||||
float a2[20],xf,yf,zf;
|
||||
double a3[20],xd,yd,zd;
|
||||
#endif
|
||||
|
||||
char alstr[3000] ;
|
||||
char *alptr = alstr ;
|
||||
|
@ -28,8 +32,10 @@ char *alptr = alstr ;
|
|||
struct tp2
|
||||
{ char c1;
|
||||
int i,j;
|
||||
#ifndef NOFLOAT
|
||||
float aaa;
|
||||
double bbb;
|
||||
#endif
|
||||
} r1,r2,*p3;
|
||||
|
||||
struct node
|
||||
|
@ -40,9 +46,12 @@ struct node
|
|||
main()
|
||||
{ ect = 0; pct = 0;
|
||||
test1();test2();test3();
|
||||
test4();test5();test6();
|
||||
test7();test8();test9();
|
||||
test10();test11();
|
||||
test4();test5();
|
||||
test6();test7();test8();
|
||||
test9();test10();
|
||||
#ifndef NOFLOAT
|
||||
test11();
|
||||
#endif
|
||||
printf("program test1\n");
|
||||
printf("%d tests completed. Number of errors = %d\n",pct,ect);
|
||||
return 0 ;
|
||||
|
@ -61,7 +70,9 @@ char *alloc(size) {
|
|||
}
|
||||
|
||||
int abs(a) int a ; { return ( a<0 ? -a : a) ; }
|
||||
#ifndef NOFLOAT
|
||||
double fabs(a) double a ; { return( a<0 ? -a : a) ; }
|
||||
#endif
|
||||
|
||||
e(n)
|
||||
{ ect++; printf("error %d in test %d \n",n,t);
|
||||
|
@ -98,7 +109,7 @@ test1()
|
|||
if ( -'z' / 01 != -'z' ) e(21);
|
||||
if ( 077777 >> 3 != 07777 ) e(22);
|
||||
if ( 077777 >> 15 ) e(23);
|
||||
if ( 234 << 6 != 234 >> -6 ) e(24);
|
||||
if ( 234 << 6 != 234 << 6 ) e(24);
|
||||
if ( 0124 & 07765 != 0124 ) e(25);
|
||||
if ( 34 & 31 != 2 ) e(26);
|
||||
if ( ( -4 | 3 ) != -1 ) e(27);
|
||||
|
@ -168,8 +179,6 @@ test2()
|
|||
if ( (i > j ? k : k*j ) != 6 ) e(20);
|
||||
if ( (i < j ? k : k*j ) != 3 ) e(21);
|
||||
if ( j<<i != l ) e(22);
|
||||
if ( j>> -i != l ) e(23);
|
||||
if ( j<< -i != i ) e(24);
|
||||
if ( j>> i != i ) e(25);
|
||||
if ( i++ != 1 ) e(26);
|
||||
if ( --i != 1 ) e(27);
|
||||
|
@ -207,8 +216,6 @@ test3()
|
|||
if ( (a > b ? c : c*b ) != 6 ) e(20);
|
||||
if ( (a < b ? c : c*b ) != 3 ) e(21);
|
||||
if ( b<<a != d ) e(22);
|
||||
if ( b>> -a != d ) e(23);
|
||||
if ( b<< -a != a ) e(24);
|
||||
if ( b>> a != a ) e(25);
|
||||
if ( a++ != 1 ) e(26);
|
||||
if ( --a != 1 ) e(27);
|
||||
|
@ -221,14 +228,21 @@ test3()
|
|||
|
||||
test4()
|
||||
/* global arrays */
|
||||
{ float epsf;
|
||||
{
|
||||
#ifndef NOFLOAT
|
||||
float epsf;
|
||||
double epsd;
|
||||
t=4; pct++; epsf = 1e-7; epsd = 1e-17;
|
||||
#endif
|
||||
t=4; pct++;
|
||||
#ifndef NOFLOAT
|
||||
epsf = 1e-7; epsd = 1e-17;
|
||||
#endif
|
||||
for ( i=0; i<20 ; i++ ) a1[i] = i*i;
|
||||
if ( a1[9] != 81 || a1[17] != 289 || a1[0] != 0 ) e(1);
|
||||
if ( a1[1] + a1[2] + a1[3] != 14 ) e(2);
|
||||
if ( ! a1[15] ) e(3);
|
||||
if ( a1[8] / a1[4] != 4 ) e(4);
|
||||
#ifndef NOFLOAT
|
||||
for ( i=0; i<20; i++ ) a2[i] = 10.0e-1 + i/54.324e-1;
|
||||
if ( fabs(a2[4]*a2[4]-a2[4]*(10.0e-1 + 4/54.324e-1 ) ) > epsf ) e(5);
|
||||
if ( fabs(a2[8]/a2[8]*a2[9]/a2[9]-a2[10]+a2[10]-1.0 ) > epsf ) e(6);
|
||||
|
@ -237,53 +251,25 @@ test4()
|
|||
if ( fabs(a3[4]*a3[4]-a3[4]*(1.0e0+4/54.324e-1 )) > epsd ) e(8);
|
||||
if ( fabs( a3[8]*a3[9]/a3[8]/a3[9]-a3[10]+a3[10]-1000e-3) > epsd ) e(9);
|
||||
if ( fabs(a3[8]+a3[6]-2*a3[7]) > epsd ) e(10);
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
test5()
|
||||
/* real arithmetic */
|
||||
{
|
||||
double epsd; float epsf;
|
||||
t = 5; pct++; epsf = 1e-7; epsd = 1e-17;
|
||||
xf = 1.50 ; yf = 3.00 ; zf = 0.10;
|
||||
xd = 1.50 ; yd = 3.00 ; zd = 0.10;
|
||||
if ( fabs(1.0 + 1.0 - 2.0 ) > epsd ) e(1);
|
||||
if ( fabs( 1e10-1e10 ) > epsd ) e(2);
|
||||
if ( abs( 1.0e+5*1.0e+5-100e+8 ) > epsd ) e(3);
|
||||
if ( fabs( 10.0/3.0*3.0/10.0-100e-2 ) > epsd ) e(4);
|
||||
if ( 0.0e0 != 0 ) e(5);
|
||||
if ( fabs( 32767.0 - 32767 ) > epsd ) e(6);
|
||||
if ( fabs( 1.0+2+5+3.0e0+7.5e+1+140e-1-100.0 ) > epsd ) e(7);
|
||||
if ( fabs(-1+(-1)+(-1.0)+(-1.0e0)+(-1.0e-0)+(-1e0)+6 ) > epsd ) e(8);
|
||||
if ( fabs(5.0*yf*zf-xf) > epsf ) e(9);
|
||||
if ( fabs(5.0*yd*zd-xd) > epsd ) e(10);
|
||||
if ( fabs(yd*yd - (2.0*xd)*(2.0*xd) ) > epsd ) e(11);
|
||||
if ( fabs(yf*yf - (2.0*xf)*(2.0*xf) ) > epsf ) e(12);
|
||||
if ( fabs( yd*yd+zd*zd+2.0*yd*zd-(yd+zd)*(zd+yd) ) > epsd ) e(13);
|
||||
if ( fabs( yf*yf+zf*zf+2.0*yf*zf-(yf+zf)*(zf+yf) ) > epsf ) e(14);
|
||||
xf=1.10;yf=1.20;
|
||||
if ( yd<xd ) e(15);
|
||||
if ( yd<=xd ) e(16);
|
||||
if ( yd==xd ) e(17);
|
||||
if ( xd>=yd ) e(18);
|
||||
if ( yd<xd ) e(19);
|
||||
if ( fabs(yd-xd-1.5) > epsd ) e(20);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
test6()
|
||||
test5()
|
||||
/* local arrays */
|
||||
{ int b1[20]; float epsf, b2[20]; double b3[20],epsd;
|
||||
{ int b1[20];
|
||||
#ifndef NOFLOAT
|
||||
float epsf, b2[20]; double b3[20],epsd;
|
||||
epsf = 1e-7; epsd = 1e-17;
|
||||
t = 6; pct++;
|
||||
#endif
|
||||
t = 5; pct++;
|
||||
for ( i=0; i<20 ; i++ ) b1[i] = i*i;
|
||||
if ( b1[9]-b1[8] != 17 ) e(1);
|
||||
if ( b1[3] + b1[4] != b1[5] ) e(2);
|
||||
if ( b1[1] != 1||b1[3] != 9 || b1[5] != 25 || b1[7] != 49 ) e(3);
|
||||
if ( b1[12] / b1[6] != 4 ) e(4);
|
||||
#ifndef NOFLOAT
|
||||
for ( i=0; i<20; i += 1) b2[i] = 10.0e-1+i/54.324e-1;
|
||||
if (fabs(b2[4]*b2[4]-b2[4]*(10.0e-1+4/54.324e-1)) > epsf ) e(5);
|
||||
if (fabs(b2[8]/b2[8]*b2[9]/b2[9]-b2[10]+b2[10]-1.0) > epsf ) e(6);
|
||||
|
@ -292,6 +278,7 @@ test6()
|
|||
if (fabs(b3[4]*b3[4]-b3[4]*(10.0e-1+4/54.324e-1)) > epsd ) e(8);
|
||||
if (fabs(b3[8]*b3[9]/b3[8]/b3[9]+b3[10]-b3[10]-1.0) > epsd ) e(9);
|
||||
if (fabs(b3[10]+b3[18]-2*b3[14]) > epsd ) e(10);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -299,11 +286,16 @@ test6()
|
|||
|
||||
|
||||
|
||||
test7()
|
||||
test6()
|
||||
/* mixed local and global */
|
||||
{ int li,b1[20];
|
||||
#ifndef NOFLOAT
|
||||
double b3[10],xxd,epsd;
|
||||
t = 7; pct++;epsd = 1e-17;
|
||||
#endif
|
||||
t = 6; pct++;
|
||||
#ifndef NOFLOAT
|
||||
epsd = 1e-17;
|
||||
#endif
|
||||
li = 6; i = li ;
|
||||
if ( i != 6 ) e(1);
|
||||
i = 6; li = i;
|
||||
|
@ -316,27 +308,40 @@ test7()
|
|||
if ( b1[7]/a1[4] != a1[2] ) e(6);
|
||||
li = i = 121;
|
||||
if ( b1[10] != i && a1[11]!= li ) e(7);
|
||||
#ifndef NOFLOAT
|
||||
for ( li=0 ; li<10; li++ ) b3[li]= 1.0e0 + li/54.324e-1;
|
||||
if ( fabs(b3[9]-a3[9]) > epsd ) e(8);
|
||||
if ( fabs(8/54.324e-1 - b3[9]+a3[1] ) > epsd ) e(9);
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
|
||||
test8()
|
||||
test7()
|
||||
/*global records */
|
||||
{ t=8; pct++;
|
||||
r1.c1= 'x';r1.i=40;r1.j=50;r1.aaa=3.0;r1.bbb=4.0;
|
||||
{ t=7; pct++;
|
||||
r1.c1= 'x';r1.i=40;r1.j=50;
|
||||
#ifndef NOFLOAT
|
||||
r1.aaa=3.0;r1.bbb=4.0;
|
||||
#endif
|
||||
r2.c1=r1.c1;
|
||||
r2.i= 50;
|
||||
r2.j=40;r2.aaa=4.0;r2.bbb=5.0;
|
||||
if (r1.c1 != 'x' || r1.i != 40 || r1.aaa != 3.0 ) e(1);
|
||||
r2.j=40;
|
||||
#ifndef NOFLOAT
|
||||
r2.aaa=4.0;r2.bbb=5.0;
|
||||
#endif
|
||||
if (r1.c1 != 'x' || r1.i != 40 ) e(1);
|
||||
#ifndef NOFLOAT
|
||||
if ( r1.aaa != 3.0 ) e(1);
|
||||
#endif
|
||||
i = 25;j=75;
|
||||
if (r1.i != 40 || r2.i != 50 ) e(2);
|
||||
if ( r2.j != 40 || r1.j != 50 ) e(3);
|
||||
if ( (r1.c1 + r2.c1)/2 != 'x' ) e(4);
|
||||
#ifndef NOFLOAT
|
||||
if ( r1.aaa*r1.aaa+r2.aaa*r2.aaa != r2.bbb*r2.bbb) e(5);
|
||||
#endif
|
||||
r1.i = 34; if ( i!=25 ) e(6);
|
||||
}
|
||||
|
||||
|
@ -344,29 +349,40 @@ test8()
|
|||
/****************************************************************/
|
||||
|
||||
|
||||
test9()
|
||||
test8()
|
||||
/*local records */
|
||||
{ struct tp2 s1,s2;
|
||||
t=9; pct++;
|
||||
s1.c1= 'x';s1.i=40;s1.j=50;s1.aaa=3.0;s1.bbb=4.0;
|
||||
t=8; pct++;
|
||||
s1.c1= 'x';s1.i=40;s1.j=50;
|
||||
#ifndef NOFLOAT
|
||||
s1.aaa=3.0;s1.bbb=4.0;
|
||||
#endif
|
||||
s2.c1=s1.c1;
|
||||
s2.i= 50;
|
||||
s2.j=40;s2.aaa=4.0;s2.bbb=5.0;
|
||||
if (s1.c1 != 'x' || s1.i != 40 || s1.aaa != 3.0 ) e(1);
|
||||
s2.j=40;
|
||||
#ifndef NOFLOAT
|
||||
s2.aaa=4.0;s2.bbb=5.0;
|
||||
#endif
|
||||
if (s1.c1 != 'x' || s1.i != 40 ) e(1);
|
||||
#ifndef NOFLOAT
|
||||
if ( s1.aaa != 3.0 ) e(1);
|
||||
#endif
|
||||
i = 25;j=75;
|
||||
if (s1.i != 40 || s2.i != 50 ) e(2);
|
||||
if ( s2.j != 40 || s1.j != 50 ) e(3);
|
||||
if ( (s1.c1 + s2.c1)/2 != 'x' ) e(4);
|
||||
#ifndef NOFLOAT
|
||||
if ( s1.aaa*s1.aaa+s2.aaa*s2.aaa != s2.bbb*s2.bbb) e(5);
|
||||
#endif
|
||||
s1.i = 34; if ( i!=25 ) e(6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
test10()
|
||||
test9()
|
||||
/*global pointers */
|
||||
{ t=10; pct++;
|
||||
{ t=9; pct++;
|
||||
p1=alloc( sizeof *p1 );
|
||||
p2=alloc( sizeof *p2);
|
||||
p3=alloc(sizeof *p3);
|
||||
|
@ -397,13 +413,13 @@ test10()
|
|||
}
|
||||
|
||||
/*****************************************************************/
|
||||
test11()
|
||||
test10()
|
||||
/*local pointers */
|
||||
{ struct tp2 *pp3;
|
||||
struct node *pp2,*ingang,*uitgang;
|
||||
int *pp1;
|
||||
int b1[20];
|
||||
t=11; pct++;
|
||||
t=10; pct++;
|
||||
pp1=alloc( sizeof *pp1 );
|
||||
pp2=alloc( sizeof *p2);
|
||||
pp3=alloc(sizeof *pp3);
|
||||
|
@ -428,4 +444,39 @@ test11()
|
|||
if ( uitgang->next->next->next->next->next->val != 1) e(8);
|
||||
}
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
#ifndef NOFLOAT
|
||||
test11()
|
||||
/* real arithmetic */
|
||||
{
|
||||
double epsd; float epsf;
|
||||
t = 11; pct++; epsf = 1e-7; epsd = 1e-16;
|
||||
xf = 1.50 ; yf = 3.00 ; zf = 0.10;
|
||||
xd = 1.50 ; yd = 3.00 ; zd = 0.10;
|
||||
if ( fabs(1.0 + 1.0 - 2.0 ) > epsd ) e(1);
|
||||
if ( fabs( 1e10-1e10 ) > epsd ) e(2);
|
||||
if ( abs( 1.0e+5*1.0e+5-100e+8 ) > epsd ) e(3);
|
||||
if ( fabs( 10.0/3.0*3.0/10.0-100e-2 ) > epsd ) e(4);
|
||||
if ( 0.0e0 != 0 ) e(5);
|
||||
if ( fabs( 32767.0 - 32767 ) > epsd ) e(6);
|
||||
if ( fabs( 1.0+2+5+3.0e0+7.5e+1+140e-1-100.0 ) > epsd ) e(7);
|
||||
if ( fabs(-1+(-1)+(-1.0)+(-1.0e0)+(-1.0e-0)+(-1e0)+6 ) > epsd ) e(8);
|
||||
if ( fabs(5.0*yf*zf-xf) > epsf ) e(9);
|
||||
if ( fabs(5.0*yd*zd-xd) > epsd ) e(10);
|
||||
if ( fabs(yd*yd - (2.0*xd)*(2.0*xd) ) > epsd ) e(11);
|
||||
if ( fabs(yf*yf - (2.0*xf)*(2.0*xf) ) > epsf ) e(12);
|
||||
if ( fabs( yd*yd+zd*zd+2.0*yd*zd-(yd+zd)*(zd+yd) ) > epsd ) e(13);
|
||||
if ( fabs( yf*yf+zf*zf+2.0*yf*zf-(yf+zf)*(zf+yf) ) > epsf ) e(14);
|
||||
xf=1.10;yf=1.20;
|
||||
if ( yd<xd ) e(15);
|
||||
if ( yd<=xd ) e(16);
|
||||
if ( yd==xd ) e(17);
|
||||
if ( xd>=yd ) e(18);
|
||||
if ( yd<xd ) e(19);
|
||||
if ( fabs(yd-xd-1.5) > epsd ) e(20);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
main() {
|
||||
none() ;
|
||||
printf("Undetected: declaration of argument not present in argument list\n") ;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
/* Author: E.G. Keizer */
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
/* Test initialisation of a V7 C-compiler */
|
||||
/* 1 sept 1980 */
|
||||
#include "../local.h"
|
||||
|
@ -90,6 +92,7 @@ pch() {
|
|||
printf("mult[0],mult[1],mult[2] %s, %s, %s\n",mult[0],mult[1],mult[2]);
|
||||
}
|
||||
|
||||
#ifndef NOFLOAT
|
||||
/* floats */
|
||||
|
||||
float fl1 = 0 ;
|
||||
|
@ -171,6 +174,7 @@ printf("dbl1\t%.20e\ndbl2\t%.20e\ndbl2\t%.20e\ndbl4\t%.20e\ndbl5\t%.20e\ndbl6\t%
|
|||
|
||||
printf("\n") ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* long */
|
||||
long lo1 = 14L ;
|
||||
|
@ -193,12 +197,18 @@ struct s1 {
|
|||
int s_i ;
|
||||
char s_ca[3] ;
|
||||
long s_l ;
|
||||
#ifndef NOFLOAT
|
||||
double s_f ;
|
||||
#endif
|
||||
struct s1 *s_s1 ;
|
||||
} ;
|
||||
struct s1 st1 ;
|
||||
struct s1 sta[3] = {
|
||||
#ifndef NOFLOAT
|
||||
1 , { 'a' , 'b' , 'c' } , 10 , -10 , &sta[0] ,
|
||||
#else
|
||||
1 , { 'a' , 'b' , 'c' } , 10 , &sta[0] ,
|
||||
#endif
|
||||
{ 2 } ,
|
||||
3
|
||||
} ;
|
||||
|
@ -229,8 +239,10 @@ pstruct() {
|
|||
st1.s_ca[2],sta[0].s_ca[2],sta[1].s_ca[2],sta[2].s_ca[2]) ;
|
||||
printf("s_l\t%15D%15D%15D%15D\n",
|
||||
st1.s_l,sta[0].s_l,sta[1].s_l,sta[2].s_l) ;
|
||||
#ifndef NOFLOAT
|
||||
printf("s_f\t %13e %13e %13e %13e\n\n",
|
||||
st1.s_f,sta[0].s_f,sta[1].s_f,sta[2].s_f) ;
|
||||
#endif
|
||||
printf("(sta[0].s_s1)->s_i = %d\n",(sta[0].s_s1)->s_i) ;
|
||||
|
||||
printf("\nbit fields:\n\n") ;
|
||||
|
@ -242,8 +254,10 @@ pstruct() {
|
|||
main() {
|
||||
pint() ;
|
||||
pch() ;
|
||||
#ifndef NOFLOAT
|
||||
pflt() ;
|
||||
pdbl() ;
|
||||
#endif
|
||||
plong() ;
|
||||
pstruct() ;
|
||||
return(0) ;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
main(argc,argv,envp) char **argv,**envp ; {
|
||||
register int rargc ;
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
static int level = 0 ;
|
||||
int procentry(name) char *name ; {
|
||||
register int count ;
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
char rcs_id2[] = "$Header$" ;
|
||||
|
||||
/* Author: E.G. Keizer */
|
||||
|
||||
int fac(n) { return ( n==0 ? 1 : n*fac(n-1)) ; }
|
||||
|
|
|
@ -21,9 +21,17 @@ static char rcs_id[]= "$Header$" ;
|
|||
/* test for structure parameters, assignment and return */
|
||||
# define ASIZE 26
|
||||
|
||||
struct w1 { int w1_i ; } ;
|
||||
struct w2 { int w2_i ; double w2_d ; } ;
|
||||
struct w3 { char w3_a[ASIZE] ; double w3_x ; } ;
|
||||
struct w1 {
|
||||
int w1_i ;
|
||||
} ;
|
||||
struct w2 {
|
||||
int w2_i ;
|
||||
long w2_l ;
|
||||
} ;
|
||||
struct w3 {
|
||||
char w3_a[ASIZE] ;
|
||||
unsigned w3_u ;
|
||||
} ;
|
||||
|
||||
struct w1 es1 ;
|
||||
struct w1 es2[3] ;
|
||||
|
@ -70,24 +78,24 @@ asst() {
|
|||
|
||||
printf("w2\n") ;
|
||||
s2t1.w2_i = 18000 ;
|
||||
s2t1.w2_d = 3.1415 ;
|
||||
s2t1.w2_l = 31415 ;
|
||||
s2t2 = s2t1 ;
|
||||
printf("\ts2t2: .w2_i %d .w2_d %f\n",s2t2.w2_i,s2t2.w2_d) ;
|
||||
printf("\ts2t2: .w2_i %d .w2_l %ld\n",s2t2.w2_i,s2t2.w2_l) ;
|
||||
s2t3 = &s2t2 ;
|
||||
printf("\ts2t3->w2_d %f\n",s2t3->w2_d) ;
|
||||
printf("\ts2t3->w2_l %ld\n",s2t3->w2_l) ;
|
||||
|
||||
printf("w3\n") ;
|
||||
for ( i = 0 ; i<ASIZE ; i++ ) {
|
||||
s3t1.w3_a[i]= 'a'+i ;
|
||||
}
|
||||
s3t1.w3_x = 1.0 ;
|
||||
s3t1.w3_u = 0x8000 ;
|
||||
s3t2 = s3t1 ;
|
||||
s3t3 = &s3t1 ;
|
||||
for ( i = 0 ; i<ASIZE ; i++ ) {
|
||||
printf("s3t2.w3_a[%2d] %c\n",i,s3t2.w3_a[i]) ;
|
||||
}
|
||||
printf("s3t2.w3_x %f\n",s3t2.w3_x) ;
|
||||
s3t2.w3_x = 1/3.1415 ;
|
||||
printf("s3t2.w3_u %x\n",s3t2.w3_u) ;
|
||||
s3t2.w3_u = 1415 ;
|
||||
for ( i = 0 ; i<ASIZE ; i++ ) {
|
||||
s3t2.w3_a[i]= 'A'+i ;
|
||||
}
|
||||
|
@ -95,7 +103,7 @@ asst() {
|
|||
for ( i = 0 ; i<ASIZE ; i++ ) {
|
||||
printf("s3t1.w3_a[%2d] %c\n",i,s3t1.w3_a[i]) ;
|
||||
}
|
||||
printf("s3t1.w3_x %f",s3t1.w3_x) ;
|
||||
printf("s3t1.w3_u %x",s3t1.w3_u) ;
|
||||
}
|
||||
|
||||
struct w3 epars ;
|
||||
|
@ -110,7 +118,7 @@ part() {
|
|||
for ( i=0 ; i<ASIZE ; i++ ) {
|
||||
pars.w3_a[i]=i+1 ;
|
||||
}
|
||||
pars.w3_x = 2.81 ;
|
||||
pars.w3_u = 281 ;
|
||||
printf("\nstructure parameters\n") ;
|
||||
psc(-1,pars,1000) ;
|
||||
}
|
||||
|
@ -122,7 +130,7 @@ psc(before,str,after) int before, after ; struct w3 str ; {
|
|||
for ( i=0 ; i<ASIZE ; i++ ) {
|
||||
printf("str.w3_a[%2d]\t%d\n",i,str.w3_a[i]) ;
|
||||
}
|
||||
printf("str.w3_x %f\n",str.w3_x) ;
|
||||
printf("str.w3_u %x\n",str.w3_u) ;
|
||||
printf("after %d\n",after) ;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
#include <signal.h>
|
||||
|
||||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
foo()
|
||||
{
|
||||
printf("signal received\n");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
char rcs_id[] = "$Header$" ;
|
||||
|
||||
main(argc,argv) char **argv ; {
|
||||
int child, waitchild ;
|
||||
int status ;
|
||||
|
|
Loading…
Reference in a new issue