1 From phil@cs.wwu.edu Mon Mar 20 23:13:22 1995
2 Date: Mon, 20 Mar 1995 23:12:17 -0800
3 From: Phil Nelson <phil@cs.wwu.edu>
4 To: phil@steelhead.cs.wwu.edu
5 Subject: [jhn@ironwood.cray.com: XPG4 bc(1) failures]
7 From: jhn@ironwood.cray.com (James Nordby)
8 Subject: XPG4 bc(1) failures
10 Date: Fri, 17 Mar 1995 12:14:13 -0600 (CST)
11 X-Mailer: ELM [version 2.4 PL24-CRI-b]
13 Content-Type: text/plain; charset=US-ASCII
14 Content-Transfer-Encoding: 7bit
20 Here are the test results I'm getting from the XPG4 test suite,
21 with some explanation and fixes so far. Let me know what you
25 Jim Nordby (jhn@cray.com)
28 -------- bc 08:38:34 --------
30 Assertion #20 (A): bc reads text files
31 Expected exit code = 0; Received 139
32 Standard output isn't the same as file 'bc_eso_20_1'
33 diff of "out.stdout" and "bc_eso_20_1":
34 *** out.stdout Fri Mar 17 08:39:22 1995
35 --- bc_eso_20_1 Fri Mar 17 08:39:22 1995
39 + 11111111111111111111111111111111111111111111111111111111111111111111
40 + 11111111111111111111111111111111111111111111111111111111111111111111
41 + 11111111111111111111111111111111111111111111111111111111111111111111
42 + 11111111111111111111111111111111111111111111111111111111111111111111
43 + 11111111111111111111111111111111111111111111111111111111111111111111
44 + 11111111111111111111111111111111111111111111111111111111111111111111
45 + 11111111111111111111111111111111111111111111111111111111111111111111
46 + 11111111111111111111111111111111111111111111111111111111111111111111
47 + 11111111111111111111111111111111111111111111111111111111111111111111
48 + 11111111111111111111111111111111111111111111111111111111111111111111
49 + 11111111111111111111111111111111111111111111111111111111111111111111
50 + 11111111111111111111111111111111111111111111111111111111111111111111
51 + 11111111111111111111111111111111111111111111111111111111111111111111
52 + 11111111111111111111111111111111111111111111111111111111111111111111
53 + 11111111111111111111111111111111111111111111111111111111111111111111
54 + 11111111111111111111111111111111111111111111111111111111111111111111
55 + 11111111111111111111111111111111111111111111111111111111111111111111
56 + 11111111111111111111111111111111111111111111111111111111111111111111
57 + 11111111111111111111111111111111111111111111111111111111111111111111
58 + 11111111111111111111111111111111111111111111111111111111111111111111
59 + 11111111111111111111111111111111111111111111111111111111111111111111
60 + 11111111111111111111111111111111111111111111111111111111111111111111
61 + 11111111111111111111111111111111111111111111111111111111111111111111
62 + 11111111111111111111111111111111111111111111111111111111111111111111
63 + 11111111111111111111111111111111111111111111111111111111111111111111
64 + 11111111111111111111111111111111111111111111111111111111111111111111
65 + 11111111111111111111111111111111111111111111111111111111111111111111
66 + 11111111111111111111111111111111111111111111111111111111111111111111
67 + 11111111111111111111111111111111111111111111111111111111111111111111
68 + 11111111111111111111111111111111111111111111111111111111111111111111
70 Assertion Result: FAIL
72 I couldn't reproduce this problem; when I rebuilt your bc and
73 ran it, I got a different problem with printing out a large
74 number. The XPG4 tests expected lines to be 70 characters
75 long, INCLUDING the newline (this comes from the POSIX definition
76 of a line). To fix it, I changed util.c like so:
78 *** util.c Thu Mar 16 10:47:36 1995
79 --- util.c.old Thu Mar 16 10:50:10 1995
87 - * XPG4 considers a line to include the <newline>;
88 - * therefore we want 68 numerals, <backslash>, <newline>
104 Assertion #42 (A): check reserved words
105 Standard error isn't empty
106 Contents of out.stderr:
107 (standard_in) 6: syntax error
108 (standard_in) 15: syntax error
109 Standard output isn't the same as file 'bc_eso_42_1'
110 diff of "out.stdout" and "bc_eso_42_1":
111 *** out.stdout Fri Mar 17 08:39:43 1995
112 --- bc_eso_42_1 Fri Mar 17 08:39:43 1995
119 Assertion Result: FAIL
121 This one is debatable, based on the grammar in the POSIX manual.
122 Here's the input file:
124 cat << \VSC-EOF > input
127 for ( b = 0; b < 10; b++ ) {
141 They want these constructs to be accepted:
146 for (x = 0; x < 10; x++)
158 The grammar as it's currently worded requires a '{' before hitting
159 a NEWLINE for these constructs. It's easy enough to change in bc.y
160 (see below), but if I do change it, it still barfs on the last
161 line of the file ( 'while (a() != 5)' ). Since the while lacks
162 a body, it gives a syntax error; they're expecting a '0' to be
163 returned. The grammar could be changed to support this, but is
167 *** bc.y Thu Mar 16 10:47:20 1995
168 --- bc.y.old Thu Mar 16 10:50:11 1995
174 - allow_newlines : /* empty */
175 - | NEWLINE allow_newlines
183 sprintf (genstr, "pJ%1d:N%1d:", $4, $7);
186 ! allow_newlines statement
188 sprintf (genstr, "J%1d:N%1d:",
189 continue_label, break_label);
191 sprintf (genstr, "pJ%1d:N%1d:", $4, $7);
196 sprintf (genstr, "J%1d:N%1d:",
197 continue_label, break_label);
200 sprintf (genstr, "Z%1d:", if_label);
203 ! allow_newlines statement opt_else
205 sprintf (genstr, "N%1d:", if_label);
208 sprintf (genstr, "Z%1d:", if_label);
213 sprintf (genstr, "N%1d:", if_label);
217 sprintf (genstr, "Z%1d:", break_label);
220 ! ')' allow_newlines statement
222 sprintf (genstr, "J%1d:N%1d:", $1, break_label);
225 sprintf (genstr, "Z%1d:", break_label);
230 sprintf (genstr, "J%1d:N%1d:", $1, break_label);
236 Assertion #49 (A): check strings
237 Expected exit code = 0; Received 1
238 Standard error isn't empty
239 Contents of out.stderr:
240 File (NULL) is unavailable.
241 Standard output isn't the same as file 'bc_eso_49_1'
242 diff of "out.stdout" and "bc_eso_49_1":
243 cmd-1794 diff: Missing newline at end of file 'bc_eso_49_1'.
244 *** out.stdout Fri Mar 17 08:40:01 1995
245 --- bc_eso_49_1 Fri Mar 17 08:40:01 1995
249 + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
250 *LINE CONTINUATION -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
251 *LINE CONTINUATION -aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
252 Assertion Result: FAIL
254 This gist of this is that the standard expects numbers to
255 be truncated to 70 characters, but STRINGS should not.
256 My changes to fix this are:
259 *** execute.c Thu Mar 16 13:06:39 1995
260 --- execute.c.old Thu Mar 16 10:50:09 1995
263 case 'O' : /* Write a string to the output with processing. */
264 while ((ch = byte(&pc)) != '"')
277 if (ch == '"') break;
281 - case 'a': putchar (007); break;
282 - case 'b': putchar ('\b'); break;
283 - case 'f': putchar ('\f'); break;
284 - case 'n': putchar ('\n'); break;
285 - case 'q': putchar ('"'); break;
286 - case 'r': putchar ('\r'); break;
287 - case 't': putchar ('\t'); break;
288 - case '\\': putchar ('\\'); break;
290 case 'a': out_char (007); break;
291 case 'b': out_char ('\b'); break;
292 case 'f': out_char ('\f'); break;
296 case 'r': out_char ('\r'); break;
297 case 't': out_char ('\t'); break;
298 case '\\': out_char ('\\'); break;
308 case 'w' : /* Write a string to the output. */
310 - while ((ch = byte(&pc)) != '"') putchar (ch);
312 while ((ch = byte(&pc)) != '"') out_char (ch);
314 if (interactive) fflush (stdout);
320 Assertion #77 (C): output longer than 70 characters
321 Standard output isn't the same as file 'bc_eso_77_1'
322 diff of "out.stdout" and "bc_eso_77_1":
323 *** out.stdout Fri Mar 17 08:41:13 1995
324 --- bc_eso_77_1 Fri Mar 17 08:41:13 1995
327 ! 3.3333333333333333333333333333333333333333333333333333333333333333333
328 ! 33333333333333333333333333333333
330 ! 3.333333333333333333333333333333333333333333333333333333333333333333
331 ! 333333333333333333333333333333333
332 Assertion Result: FAIL
334 Same as assertion #20 above...
339 Assertion #92 (A): check %
340 Standard output isn't the same as file 'bc_eso_92_1'
341 diff of "out.stdout" and "bc_eso_92_1":
342 *** out.stdout Fri Mar 17 08:41:33 1995
343 --- bc_eso_92_1 Fri Mar 17 08:41:33 1995
357 Assertion Result: FAIL
359 This one is a pain. The failing code looks like this:
362 scale ( 5.000000 % 2.0 )
365 They expect '6' and '5' for output, instead of '0', based on
366 the explanation of the modulus operator ("scale of the result
367 shall be 'max(scale + scale(b), scale(a)'"), even though the
368 result is a 0. I was able to fix this problem by the change
371 *** number.c Thu Mar 16 13:15:43 1995
372 --- number.c.old Thu Mar 16 10:50:09 1995
376 /* They are equal! return zero! */
377 diff = copy_num (_zero_);
379 - /* correct the scale here */
380 - diff->n_scale = MAX (n1->n_scale, n2->n_scale);
384 /* n2 is less than n1, subtract n2 from n1. */
386 but this causes another test failure that I haven't looked at.
391 Assertion #130 (A): functions are call by value
392 Standard output isn't the same as file 'bc_eso_130_1'
393 diff of "out.stdout" and "bc_eso_130_1":
394 *** out.stdout Fri Mar 17 08:42:24 1995
395 --- bc_eso_130_1 Fri Mar 17 08:42:24 1995
413 Assertion Result: FAIL
415 Assertion #131 (A): functions are call by value
416 Standard output isn't the same as file 'bc_eso_131_1'
417 diff of "out.stdout" and "bc_eso_131_1":
418 *** out.stdout Fri Mar 17 08:42:28 1995
419 --- bc_eso_131_1 Fri Mar 17 08:42:28 1995
437 Assertion Result: FAIL
440 Both of these are the 'arrays are passed by value' problem.
441 One of the test cases is below:
443 cat << \VSC-EOF > bc_in_130_1
458 They expect the assignment of a[0] inside the b() function
459 to not affect a[0] outside of the function.
465 Assertion #139 (A): check sin
466 Standard output isn't the same as file 'bc_eso_139_1'
467 diff of "out.stdout" and "bc_eso_139_1":
468 *** out.stdout Fri Mar 17 08:42:40 1995
469 --- bc_eso_139_1 Fri Mar 17 08:42:39 1995
474 1.68294196961579301330
480 1.68294196961579301330
483 Assertion Result: FAIL
485 Assertion #141 (A): check arctanngent
486 Standard output isn't the same as file 'bc_eso_141_1'
487 diff of "out.stdout" and "bc_eso_141_1":
488 *** out.stdout Fri Mar 17 08:42:44 1995
489 --- bc_eso_141_1 Fri Mar 17 08:42:44 1995
494 3.14159265358979323844
500 3.14159265358979323844
503 Assertion Result: FAIL
505 Assertion #142 (A): check log
506 Standard output isn't the same as file 'bc_eso_142_1'
507 diff of "out.stdout" and "bc_eso_142_1":
508 *** out.stdout Fri Mar 17 08:42:47 1995
509 --- bc_eso_142_1 Fri Mar 17 08:42:47 1995
514 2.30258509299404568401
520 2.30258509299404568401
523 Assertion Result: FAIL
525 Assertion #144 (A): check bessel
526 Standard output isn't the same as file 'bc_eso_144_1'
527 diff of "out.stdout" and "bc_eso_144_1":
528 *** out.stdout Fri Mar 17 08:42:51 1995
529 --- bc_eso_144_1 Fri Mar 17 08:42:51 1995
534 .57672480775687338720
540 .57672480775687338720
543 Assertion Result: FAIL
545 All of these are the same. I'll give you the test case
546 for 'sin'; what they're expecting is 0:
550 bc outputs '20' (which is the scale at the time), but the
551 interpretation of the standard says that it should be '0',
552 since s(0) is 0, and the scale of 0 is 0. I think that
553 this interpretation disagrees with one of the previous
554 assertions (assertion #92).
556 /* end of test results */
562 e-mail: phil@cs.wwu.edu
563 http://www.cs.wwu.edu/~phil