2 !!DESCRIPTION!! C-Manual Chapter 9: Statements
3 !!ORIGIN!! LCC 4.1 Testsuite
4 !!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
10 int cbits; /* No. of bits per char */
12 int sbits; /* short */
14 int ubits; /* unsigned */
15 int fbits; /* float */
16 int dbits; /* double */
18 float fprec; /* Smallest number that can be */
19 float dprec; /* significantly added to 1. */
21 int flgs; /* Print return codes, by section */
22 int flgm; /* Announce machine dependencies */
23 int flgd; /* give explicit diagnostics */
24 int flgl; /* Report local return codes. */
25 int rrc; /* recent return code */
26 int crc; /* Cumulative return code */
27 char rfs[8]; /* Return from section */
31 int ubits; /* unsigned */
32 int fbits; /* float */
33 int dbits; /* double */
35 float fprec; /* Smallest number that can be */
36 float dprec; /* significantly added to 1. */
38 int flgs; /* Print return codes, by section */
39 int flgm; /* Announce machine dependencies */
40 int flgd; /* give explicit diagnostics */
41 int flgl; /* Report local return codes. */
42 int rrc; /* recent return code */
43 int crc; /* Cumulative return code */
44 char rfs[8]; /* Return from section */
46 #ifndef NO_OLD_FUNC_DECL
47 s714(pd0) /* 7.14 Assignment operators */
51 int s714(struct defs *pd0){
53 static char f[] = "Local error %d.\n";
54 static char s714er[] = "s714,er%d\n";
55 static char qs714[8] = "s714 ";
56 register int prlc, lrc;
76 while (*pt++ = *ps++);
78 /* This section tests the assignment operators.
80 It is an exhaustive test of all assignment statements
85 where vl and vr are variables from the set
86 {char,short,int,long,unsigned,float,double} and op is
87 one of the assignment operators. There are 395 such
90 The initial values for the variables have been chosen
91 so that both the initial values and the results will
92 "fit" in just about any implementation, and that the re-
93 sults will be such that they test for the proper form-
94 ation of composite operators, rather than checking for
95 the valid operation of those operators' components.
96 For example, in checking >>=, we want to verify that
97 a right shift and a move take place, rather than
98 whether or not there may be some peculiarities about
99 the right shift. Such tests have been made previously,
100 and to repeat them here would be to throw out a red
103 The table below lists the operators, assignment targets,
104 initial values for left and right operands, and the
105 expected values of the results.
107 = += -= *= /= %= >>= <<= &= ^= |=
108 char 2 7 3 10 2 1 1 20 8 6 14
109 short 2 7 3 10 2 1 1 20 8 6 14
110 int 2 7 3 10 2 1 1 20 8 6 14
111 long 2 7 3 10 2 1 1 20 8 6 14
112 unsigned 2 7 3 10 2 1 1 20 8 6 14
113 float 2 7 3 10 2.5 | |
114 double 2 7 3 10 2.5 | |
116 initial (5,2) | (5,2) | (12,10)
118 The following machine-generated program reflects the
119 tests described in the table.
126 if(prlc) printf(f,lrc);
132 if(prlc) printf(f,lrc);
138 if(prlc) printf(f,lrc);
144 if(prlc) printf(f,lrc);
150 if(prlc) printf(f,lrc);
156 if(prlc) printf(f,lrc);
162 if(prlc) printf(f,lrc);
168 if(prlc) printf(f,lrc);
174 if(prlc) printf(f,lrc);
180 if(prlc) printf(f,lrc);
186 if(prlc) printf(f,lrc);
192 if(prlc) printf(f,lrc);
198 if(prlc) printf(f,lrc);
204 if(prlc) printf(f,lrc);
210 if(prlc) printf(f,lrc);
216 if(prlc) printf(f,lrc);
222 if(prlc) printf(f,lrc);
228 if(prlc) printf(f,lrc);
234 if(prlc) printf(f,lrc);
240 if(prlc) printf(f,lrc);
246 if(prlc) printf(f,lrc);
252 if(prlc) printf(f,lrc);
258 if(prlc) printf(f,lrc);
264 if(prlc) printf(f,lrc);
270 if(prlc) printf(f,lrc);
276 if(prlc) printf(f,lrc);
282 if(prlc) printf(f,lrc);
288 if(prlc) printf(f,lrc);
294 if(prlc) printf(f,lrc);
300 if(prlc) printf(f,lrc);
306 if(prlc) printf(f,lrc);
312 if(prlc) printf(f,lrc);
318 if(prlc) printf(f,lrc);
324 if(prlc) printf(f,lrc);
330 if(prlc) printf(f,lrc);
336 if(prlc) printf(f,lrc);
342 if(prlc) printf(f,lrc);
348 if(prlc) printf(f,lrc);
354 if(prlc) printf(f,lrc);
360 if(prlc) printf(f,lrc);
366 if(prlc) printf(f,lrc);
372 if(prlc) printf(f,lrc);
378 if(prlc) printf(f,lrc);
384 if(prlc) printf(f,lrc);
390 if(prlc) printf(f,lrc);
396 if(prlc) printf(f,lrc);
402 if(prlc) printf(f,lrc);
408 if(prlc) printf(f,lrc);
414 if(prlc) printf(f,lrc);
420 if(prlc) printf(f,lrc);
426 if(prlc) printf(f,lrc);
432 if(prlc) printf(f,lrc);
438 if(prlc) printf(f,lrc);
444 if(prlc) printf(f,lrc);
450 if(prlc) printf(f,lrc);
456 if(prlc) printf(f,lrc);
462 if(prlc) printf(f,lrc);
468 if(prlc) printf(f,lrc);
474 if(prlc) printf(f,lrc);
480 if(prlc) printf(f,lrc);
486 if(prlc) printf(f,lrc);
492 if(prlc) printf(f,lrc);
498 if(prlc) printf(f,lrc);
504 if(prlc) printf(f,lrc);
510 if(prlc) printf(f,lrc);
516 if(prlc) printf(f,lrc);
522 if(prlc) printf(f,lrc);
528 if(prlc) printf(f,lrc);
534 if(prlc) printf(f,lrc);
540 if(prlc) printf(f,lrc);
546 if(prlc) printf(f,lrc);
552 if(prlc) printf(f,lrc);
558 if(prlc) printf(f,lrc);
564 if(prlc) printf(f,lrc);
570 if(prlc) printf(f,lrc);
576 if(prlc) printf(f,lrc);
582 if(prlc) printf(f,lrc);
588 if(prlc) printf(f,lrc);
594 if(prlc) printf(f,lrc);
600 if(prlc) printf(f,lrc);
606 if(prlc) printf(f,lrc);
612 if(prlc) printf(f,lrc);
618 if(prlc) printf(f,lrc);
624 if(prlc) printf(f,lrc);
630 if(prlc) printf(f,lrc);
636 if(prlc) printf(f,lrc);
642 if(prlc) printf(f,lrc);
648 if(prlc) printf(f,lrc);
654 if(prlc) printf(f,lrc);
660 if(prlc) printf(f,lrc);
666 if(prlc) printf(f,lrc);
672 if(prlc) printf(f,lrc);
678 if(prlc) printf(f,lrc);
684 if(prlc) printf(f,lrc);
690 if(prlc) printf(f,lrc);
696 if(prlc) printf(f,lrc);
702 if(prlc) printf(f,lrc);
708 if(prlc) printf(f,lrc);
714 if(prlc) printf(f,lrc);
720 if(prlc) printf(f,lrc);
726 if(prlc) printf(f,lrc);
732 if(prlc) printf(f,lrc);
738 if(prlc) printf(f,lrc);
744 if(prlc) printf(f,lrc);
750 if(prlc) printf(f,lrc);
756 if(prlc) printf(f,lrc);
762 if(prlc) printf(f,lrc);
768 if(prlc) printf(f,lrc);
774 if(prlc) printf(f,lrc);
780 if(prlc) printf(f,lrc);
786 if(prlc) printf(f,lrc);
792 if(prlc) printf(f,lrc);
798 if(prlc) printf(f,lrc);
804 if(prlc) printf(f,lrc);
810 if(prlc) printf(f,lrc);
816 if(prlc) printf(f,lrc);
822 if(prlc) printf(f,lrc);
828 if(prlc) printf(f,lrc);
834 if(prlc) printf(f,lrc);
840 if(prlc) printf(f,lrc);
846 if(prlc) printf(f,lrc);
852 if(prlc) printf(f,lrc);
858 if(prlc) printf(f,lrc);
864 if(prlc) printf(f,lrc);
870 if(prlc) printf(f,lrc);
876 if(prlc) printf(f,lrc);
882 if(prlc) printf(f,lrc);
888 if(prlc) printf(f,lrc);
894 if(prlc) printf(f,lrc);
900 if(prlc) printf(f,lrc);
906 if(prlc) printf(f,lrc);
912 if(prlc) printf(f,lrc);
918 if(prlc) printf(f,lrc);
924 if(prlc) printf(f,lrc);
930 if(prlc) printf(f,lrc);
936 if(prlc) printf(f,lrc);
942 if(prlc) printf(f,lrc);
948 if(prlc) printf(f,lrc);
954 if(prlc) printf(f,lrc);
960 if(prlc) printf(f,lrc);
964 if(pd0->flgd != 0) printf(s714er,1);
969 /*********************************************************************************************
970 the main loop that launches the sections
971 *********************************************************************************************/
973 #ifndef NO_TYPELESS_STRUCT_PTR
974 int section(int j,struct* pd0){
976 int section(int j,void* pd0){
979 case 0: return s714(pd0);
983 #define cq_sections 1
986 C REFERENCE MANUAL (main)
989 #ifndef NO_OLD_FUNC_DECL
995 int main(int n,char **args) {
999 static struct defs d0, *pd0;
1001 d0.flgs = 1; /* These flags dictate */
1002 d0.flgm = 1; /* the verbosity of */
1003 d0.flgd = 1; /* the program. */
1008 for (j=0; j<cq_sections; j++) {
1009 d0.rrc=section(j,pd0);
1010 d0.crc=d0.crc+d0.rrc;
1011 if(d0.flgs != 0) printf("Section %s returned %d.\n",d0.rfs,d0.rrc);
1014 if(d0.crc == 0) printf("\nNo errors detected.\n");
1015 else printf("\nFailed.\n");