1 |
294 |
jeremybenn |
-- CZ1103A.ADA
|
2 |
|
|
--
|
3 |
|
|
-- Grant of Unlimited Rights
|
4 |
|
|
--
|
5 |
|
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
6 |
|
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
7 |
|
|
-- unlimited rights in the software and documentation contained herein.
|
8 |
|
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
9 |
|
|
-- this public release, the Government intends to confer upon all
|
10 |
|
|
-- recipients unlimited rights equal to those held by the Government.
|
11 |
|
|
-- These rights include rights to use, duplicate, release or disclose the
|
12 |
|
|
-- released technical data and computer software in whole or in part, in
|
13 |
|
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
14 |
|
|
-- to do so.
|
15 |
|
|
--
|
16 |
|
|
-- DISCLAIMER
|
17 |
|
|
--
|
18 |
|
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
19 |
|
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
20 |
|
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
21 |
|
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
22 |
|
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
23 |
|
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
24 |
|
|
--*
|
25 |
|
|
--
|
26 |
|
|
-- OBJECTIVE:
|
27 |
|
|
-- CHECK THAT THE PROCEDURE CHECK_FILE WORKS CORRECTLY, IN
|
28 |
|
|
-- PARTICULAR, THAT IT WILL REPORT INCORRECT FILE CONTENTS
|
29 |
|
|
-- AS TEST FAILURES.
|
30 |
|
|
|
31 |
|
|
-- THIS TEST INTENTIONALLY CONTAINS MISMATCHES BETWEEN FILE
|
32 |
|
|
-- CONTENTS AND THE 'CONTENTS' STRING PARAMETER OF PROCEDURE
|
33 |
|
|
-- CHECK_FILE.
|
34 |
|
|
|
35 |
|
|
-- PASS/FAIL CRITERIA:
|
36 |
|
|
-- IF AN IMPLEMENTATION SUPPORTS EXTERNAL FILES, IT PASSES THIS TEST
|
37 |
|
|
-- IF TEST EXECUTION REPORTS THE FOLLOWING FOUR FAILURES, REPORTS AN
|
38 |
|
|
-- INTERMEDIATE "FAILED" RESULT, REPORTS A FINAL "TENTATIVELY PASSED"
|
39 |
|
|
-- RESULT, AND REPORTS NO OTHER FAILURES.
|
40 |
|
|
-- * CZ1103A FROM CHECK_FILE: END OF LINE EXPECTED - E
|
41 |
|
|
-- ENCOUNTERED.
|
42 |
|
|
-- * CZ1103A FROM CHECK_FILE: END_OF_PAGE NOT WHERE EXPECTED.
|
43 |
|
|
-- * CZ1103A FROM CHECK_FILE: END_OF_FILE NOT WHERE EXPECTED.
|
44 |
|
|
-- * CZ1103A FROM CHECK_FILE: FILE DOES NOT CONTAIN CORRECT
|
45 |
|
|
-- OUTPUT - EXPECTED C - GOT I.
|
46 |
|
|
--
|
47 |
|
|
-- IF AN IMPLEMENTATION DOES NOT SUPPORT EXTERNAL FILES, IT PASSES THIS
|
48 |
|
|
-- TEST IF TEST EXECUTION REPORTS NINE FAILURES FOR INCOMPLETE SUBTESTS
|
49 |
|
|
-- SIMILAR TO THE SAMPLE BELOW, REPORTS AN INTERMEDIATE "FAILED" RESULT,
|
50 |
|
|
-- REPORTS A FINAL "TENTATIVELY PASSED" RESULT, AND REPORTS NO OTHER
|
51 |
|
|
-- FAILURES.
|
52 |
|
|
-- * CZ1103A TEST WITH EMPTY FILE INCOMPLETE.
|
53 |
|
|
|
54 |
|
|
-- HISTORY:
|
55 |
|
|
-- SPS 12/09/82 CREATED ORIGINAL TEST.
|
56 |
|
|
-- JRK 11/18/85 ADDED COMMENTS ABOUT PASS/FAIL CRITERIA.
|
57 |
|
|
-- JET 01/13/88 UPDATED HEADER FORMAT, ADDED FINAL CALL TO
|
58 |
|
|
-- SPECIAL_ACTION.
|
59 |
|
|
-- PWB 06/24/88 CORRECTED PASS/FAIL CRITERIA TO INDICATE THE
|
60 |
|
|
-- EXPECTED RESULT (TENTATIVELY PASSED).
|
61 |
|
|
-- RLB 03/20/00 CORRECTED PASS/FAIL CRITERIA TO REFLECT PROPER RESULT
|
62 |
|
|
-- FOR AN IMPLEMENTATION THAT DOES NOT SUPPORT EXTERNAL FILES.
|
63 |
|
|
|
64 |
|
|
WITH REPORT; USE REPORT;
|
65 |
|
|
WITH TEXT_IO; USE TEXT_IO;
|
66 |
|
|
WITH CHECK_FILE;
|
67 |
|
|
|
68 |
|
|
PROCEDURE CZ1103A IS
|
69 |
|
|
|
70 |
|
|
NULL_FILE : FILE_TYPE;
|
71 |
|
|
FILE_WITH_BLANK_LINES : FILE_TYPE;
|
72 |
|
|
FILE_WITH_BLANK_PAGES : FILE_TYPE;
|
73 |
|
|
FILE_WITH_TRAILING_BLANKS : FILE_TYPE;
|
74 |
|
|
FILE_WITHOUT_TRAILING_BLANKS : FILE_TYPE;
|
75 |
|
|
FILE_WITH_END_OF_LINE_ERROR : FILE_TYPE;
|
76 |
|
|
FILE_WITH_END_OF_PAGE_ERROR : FILE_TYPE;
|
77 |
|
|
FILE_WITH_END_OF_FILE_ERROR : FILE_TYPE;
|
78 |
|
|
FILE_WITH_DATA_ERROR : FILE_TYPE;
|
79 |
|
|
|
80 |
|
|
BEGIN
|
81 |
|
|
|
82 |
|
|
TEST ("CZ1103A", "CHECK THAT PROCEDURE CHECK_FILE WORKS");
|
83 |
|
|
|
84 |
|
|
-- THIS SECTION TESTS CHECK_FILE WITH AN EMPTY FILE.
|
85 |
|
|
|
86 |
|
|
BEGIN
|
87 |
|
|
COMMENT ("BEGIN TEST WITH AN EMPTY FILE");
|
88 |
|
|
CREATE (NULL_FILE, OUT_FILE);
|
89 |
|
|
CHECK_FILE (NULL_FILE, "#@%");
|
90 |
|
|
CLOSE (NULL_FILE);
|
91 |
|
|
EXCEPTION
|
92 |
|
|
WHEN OTHERS =>
|
93 |
|
|
FAILED ("TEST WITH EMPTY FILE INCOMPLETE");
|
94 |
|
|
|
95 |
|
|
END;
|
96 |
|
|
|
97 |
|
|
-- THIS SECTION TESTS CHECK_FILE WITH A FILE WITH BLANK LINES.
|
98 |
|
|
|
99 |
|
|
BEGIN
|
100 |
|
|
COMMENT ("BEGIN TEST WITH A FILE WITH BLANK LINES");
|
101 |
|
|
CREATE (FILE_WITH_BLANK_LINES, OUT_FILE);
|
102 |
|
|
NEW_LINE (FILE_WITH_BLANK_LINES, 20);
|
103 |
|
|
CHECK_FILE (FILE_WITH_BLANK_LINES, "####################@%");
|
104 |
|
|
CLOSE (FILE_WITH_BLANK_LINES);
|
105 |
|
|
EXCEPTION
|
106 |
|
|
WHEN OTHERS =>
|
107 |
|
|
FAILED ("TEST WITH FILE WITH BLANK LINES INCOMPLETE");
|
108 |
|
|
END;
|
109 |
|
|
|
110 |
|
|
-- THIS SECTION TESTS CHECK_FILE WITH A FILE WITH BLANK LINES AND PAGES.
|
111 |
|
|
|
112 |
|
|
BEGIN
|
113 |
|
|
COMMENT ("BEGIN TEST WITH A FILE WITH BLANK LINES " &
|
114 |
|
|
"AND PAGES");
|
115 |
|
|
CREATE (FILE_WITH_BLANK_PAGES, OUT_FILE);
|
116 |
|
|
NEW_LINE (FILE_WITH_BLANK_PAGES, 3);
|
117 |
|
|
NEW_PAGE (FILE_WITH_BLANK_PAGES);
|
118 |
|
|
NEW_LINE (FILE_WITH_BLANK_PAGES, 2);
|
119 |
|
|
NEW_PAGE (FILE_WITH_BLANK_PAGES);
|
120 |
|
|
NEW_PAGE (FILE_WITH_BLANK_PAGES);
|
121 |
|
|
CHECK_FILE (FILE_WITH_BLANK_PAGES, "###@##@#@%");
|
122 |
|
|
CLOSE (FILE_WITH_BLANK_PAGES);
|
123 |
|
|
EXCEPTION
|
124 |
|
|
WHEN OTHERS =>
|
125 |
|
|
FAILED ("TEST WITH FILE WITH BLANK PAGES INCOMPLETE");
|
126 |
|
|
END;
|
127 |
|
|
|
128 |
|
|
-- THIS SECTION TESTS CHECK_FILE WITH A FILE WITH TRAILING BLANKS.
|
129 |
|
|
|
130 |
|
|
BEGIN
|
131 |
|
|
COMMENT ("BEGIN TEST WITH A FILE WITH TRAILING BLANKS");
|
132 |
|
|
CREATE (FILE_WITH_TRAILING_BLANKS, OUT_FILE);
|
133 |
|
|
FOR I IN 1 .. 3 LOOP
|
134 |
|
|
PUT_LINE (FILE_WITH_TRAILING_BLANKS,
|
135 |
|
|
"LINE WITH TRAILING BLANKS ");
|
136 |
|
|
END LOOP;
|
137 |
|
|
CHECK_FILE(FILE_WITH_TRAILING_BLANKS, "LINE WITH TRAILING" &
|
138 |
|
|
" BLANKS#LINE WITH TRAILING BLANKS#LINE" &
|
139 |
|
|
" WITH TRAILING BLANKS#@%");
|
140 |
|
|
CLOSE (FILE_WITH_TRAILING_BLANKS);
|
141 |
|
|
EXCEPTION
|
142 |
|
|
WHEN OTHERS =>
|
143 |
|
|
FAILED ("TEST WITH FILE WITH TRAILING BLANKS " &
|
144 |
|
|
"INCOMPLETE");
|
145 |
|
|
END;
|
146 |
|
|
|
147 |
|
|
-- THIS SECTION TESTS CHECK_FILE WITH A FILE WITHOUT TRAILING BLANKS.
|
148 |
|
|
|
149 |
|
|
BEGIN
|
150 |
|
|
COMMENT ("BEGIN TEST WITH A FILE WITHOUT TRAILING BLANKS");
|
151 |
|
|
CREATE (FILE_WITHOUT_TRAILING_BLANKS, OUT_FILE);
|
152 |
|
|
FOR I IN 1 .. 3 LOOP
|
153 |
|
|
PUT_LINE (FILE_WITHOUT_TRAILING_BLANKS,
|
154 |
|
|
"LINE WITHOUT TRAILING BLANKS");
|
155 |
|
|
END LOOP;
|
156 |
|
|
CHECK_FILE(FILE_WITHOUT_TRAILING_BLANKS, "LINE WITHOUT " &
|
157 |
|
|
"TRAILING BLANKS#LINE WITHOUT TRAILING BLANKS#" &
|
158 |
|
|
"LINE WITHOUT TRAILING BLANKS#@%");
|
159 |
|
|
CLOSE (FILE_WITHOUT_TRAILING_BLANKS);
|
160 |
|
|
EXCEPTION
|
161 |
|
|
WHEN OTHERS =>
|
162 |
|
|
FAILED ("TEST WITH FILE WITHOUT TRAILING BLANKS " &
|
163 |
|
|
"INCOMPLETE");
|
164 |
|
|
END;
|
165 |
|
|
|
166 |
|
|
-- THIS SECTION TESTS CHECK_FILE WITH A FILE WITH AN END OF LINE ERROR.
|
167 |
|
|
|
168 |
|
|
BEGIN
|
169 |
|
|
COMMENT ("BEGIN TEST WITH A FILE WITH AN END OF LINE ERROR");
|
170 |
|
|
CREATE (FILE_WITH_END_OF_LINE_ERROR, OUT_FILE);
|
171 |
|
|
PUT_LINE (FILE_WITH_END_OF_LINE_ERROR, "THIS LINE WILL " &
|
172 |
|
|
"CONTAIN AN END OF LINE IN THE WRONG PLACE");
|
173 |
|
|
CHECK_FILE (FILE_WITH_END_OF_LINE_ERROR, "THIS LINE WILL " &
|
174 |
|
|
"CONTAIN AN # IN THE WRONG PLACE#@%");
|
175 |
|
|
CLOSE (FILE_WITH_END_OF_LINE_ERROR);
|
176 |
|
|
EXCEPTION
|
177 |
|
|
WHEN OTHERS =>
|
178 |
|
|
FAILED ("TEST WITH END_OF_LINE ERROR INCOMPLETE");
|
179 |
|
|
END;
|
180 |
|
|
|
181 |
|
|
-- THIS SECTION TESTS CHECK_FILE WITH A FILE WITH AN END OF PAGE ERROR.
|
182 |
|
|
|
183 |
|
|
BEGIN
|
184 |
|
|
COMMENT ("BEGIN TEST WITH FILE WITH END OF PAGE ERROR");
|
185 |
|
|
CREATE (FILE_WITH_END_OF_PAGE_ERROR, OUT_FILE);
|
186 |
|
|
PUT_LINE (FILE_WITH_END_OF_PAGE_ERROR, "THIS LINE WILL " &
|
187 |
|
|
"CONTAIN AN END OF PAGE IN THE WRONG PLACE");
|
188 |
|
|
CHECK_FILE (FILE_WITH_END_OF_PAGE_ERROR, "THIS LINE WILL " &
|
189 |
|
|
"CONTAIN AN @ IN THE WRONG PLACE#@%");
|
190 |
|
|
CLOSE (FILE_WITH_END_OF_PAGE_ERROR);
|
191 |
|
|
EXCEPTION
|
192 |
|
|
WHEN OTHERS =>
|
193 |
|
|
FAILED ("TEST WITH END_OF_PAGE ERROR INCOMPLETE");
|
194 |
|
|
END;
|
195 |
|
|
|
196 |
|
|
-- THIS SECTION TESTS CHECK_FILE WITH A FILE WITH AN END OF FILE ERROR.
|
197 |
|
|
|
198 |
|
|
BEGIN
|
199 |
|
|
COMMENT ("BEGIN TEST WITH FILE WITH END OF FILE ERROR");
|
200 |
|
|
CREATE (FILE_WITH_END_OF_FILE_ERROR, OUT_FILE);
|
201 |
|
|
PUT_LINE (FILE_WITH_END_OF_FILE_ERROR, "THIS LINE WILL " &
|
202 |
|
|
"CONTAIN AN END OF FILE IN THE WRONG PLACE");
|
203 |
|
|
CHECK_FILE (FILE_WITH_END_OF_FILE_ERROR, "THIS LINE WILL " &
|
204 |
|
|
"CONTAIN AN % IN THE WRONG PLACE#@%");
|
205 |
|
|
CLOSE (FILE_WITH_END_OF_FILE_ERROR);
|
206 |
|
|
EXCEPTION
|
207 |
|
|
WHEN OTHERS =>
|
208 |
|
|
FAILED ("TEST WITH END_OF_FILE ERROR INCOMPLETE");
|
209 |
|
|
END;
|
210 |
|
|
|
211 |
|
|
-- THIS SECTION TESTS CHECK_FILE WITH A FILE WITH INCORRECT DATA.
|
212 |
|
|
|
213 |
|
|
BEGIN
|
214 |
|
|
COMMENT ("BEGIN TEST WITH FILE WITH INCORRECT DATA");
|
215 |
|
|
CREATE (FILE_WITH_DATA_ERROR, OUT_FILE);
|
216 |
|
|
PUT_LINE (FILE_WITH_DATA_ERROR, "LINE WITH INCORRECT " &
|
217 |
|
|
"DATA");
|
218 |
|
|
CHECK_FILE (FILE_WITH_DATA_ERROR, "LINE WITH CORRECT " &
|
219 |
|
|
"DATA#@%");
|
220 |
|
|
CLOSE (FILE_WITH_DATA_ERROR);
|
221 |
|
|
EXCEPTION
|
222 |
|
|
WHEN OTHERS =>
|
223 |
|
|
FAILED ("TEST WITH INCORRECT DATA INCOMPLETE");
|
224 |
|
|
END;
|
225 |
|
|
|
226 |
|
|
RESULT;
|
227 |
|
|
|
228 |
|
|
TEST ("CZ1103A", "THE LINE ABOVE SHOULD REPORT FAILURE");
|
229 |
|
|
SPECIAL_ACTION ("COMPARE THIS OUTPUT TO THE EXPECTED RESULT");
|
230 |
|
|
RESULT;
|
231 |
|
|
|
232 |
|
|
END CZ1103A;
|