111
|
1 -- CXF3A01.A
|
|
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 function Ada.Text_IO.Editing.Valid returns False if
|
|
28 -- a) Pic_String is not a well-formed Picture string, or
|
|
29 -- b) the length of Pic_String exceeds Max_Picture_Length, or
|
|
30 -- c) Blank_When_Zero is True and Pic_String contains '*';
|
|
31 -- Check that Valid otherwise returns True.
|
|
32 --
|
|
33 -- TEST DESCRIPTION:
|
|
34 -- This test validates the results of function Editing.Valid under a
|
|
35 -- variety of conditions. Both valid and invalid picture strings are
|
|
36 -- provided as input parameters to the function. The use of the
|
|
37 -- Blank_When_Zero parameter is evaluated with strings that contain the
|
|
38 -- zero suppression character '*'.
|
|
39 --
|
|
40 -- TEST FILES:
|
|
41 -- The following files comprise this test:
|
|
42 --
|
|
43 -- FXF3A00.A (foundation code)
|
|
44 -- => CXF3A01.A
|
|
45 --
|
|
46 --
|
|
47 -- CHANGE HISTORY:
|
|
48 -- 06 Dec 94 SAIC ACVC 2.0
|
|
49 --
|
|
50 --!
|
|
51
|
|
52 with FXF3A00;
|
|
53 with Ada.Text_IO.Editing;
|
|
54 with Report;
|
|
55
|
|
56 procedure CXF3A01 is
|
|
57 begin
|
|
58
|
|
59 Report.Test ("CXF3A01", "Check that the Valid function from package " &
|
|
60 "Ada.Text_IO.Editing returns False for strings " &
|
|
61 "that fail to comply with the composition " &
|
|
62 "constraints defined for picture strings. " &
|
|
63 "Check that the Valid function returns True " &
|
|
64 "for strings that conform to the composition " &
|
|
65 "constraints defined for picture strings");
|
|
66
|
|
67 Test_Block:
|
|
68 declare
|
|
69 use FXF3A00;
|
|
70 use Ada.Text_IO;
|
|
71 begin
|
|
72
|
|
73 -- Use a series of picture strings that conform to the composition
|
|
74 -- constraints to validate the Ada.Text_IO.Editing.Valid function.
|
|
75 -- The result for each of these calls should be True.
|
|
76 -- In all the following cases, the default value of the Blank_When_Zero
|
|
77 -- parameter is used.
|
|
78
|
|
79 for i in 1..FXF3A00.Number_Of_Valid_Strings loop
|
|
80
|
|
81 if not Editing.Valid(Pic_String => FXF3A00.Valid_Strings(i).all)
|
|
82 then
|
|
83 Report.Failed("Incorrect result from Function Valid using " &
|
|
84 "Valid_String = " & FXF3A00.Valid_Strings(i).all);
|
|
85 end if;
|
|
86
|
|
87 end loop;
|
|
88
|
|
89
|
|
90 for i in 1..FXF3A00.Number_Of_Foreign_Strings loop
|
|
91
|
|
92 if not Editing.Valid(Pic_String => FXF3A00.Foreign_Strings(i).all)
|
|
93 then
|
|
94 Report.Failed("Incorrect result from Function Valid using " &
|
|
95 "Foreign_String = " &
|
|
96 FXF3A00.Foreign_Strings(i).all);
|
|
97 end if;
|
|
98
|
|
99 end loop;
|
|
100
|
|
101
|
|
102 -- Use a series of picture strings that violate one or more of the
|
|
103 -- composition constraints to validate the Ada.Text_IO.Editing.Valid
|
|
104 -- function. The result for each of these calls should be False.
|
|
105 -- In all the following cases, the default value of the Blank_When_Zero
|
|
106 -- parameter is used.
|
|
107
|
|
108 for i in 1..FXF3A00.Number_Of_Invalid_Strings loop
|
|
109
|
|
110 if Editing.Valid(Pic_String => FXF3A00.Invalid_Strings(i).all)
|
|
111 then
|
|
112 Report.Failed("Incorrect result from Function Valid using " &
|
|
113 "Invalid_String = " &
|
|
114 FXF3A00.Invalid_Strings(i).all);
|
|
115 end if;
|
|
116
|
|
117 end loop;
|
|
118
|
|
119
|
|
120 -- In all the following cases, the default value of the Blank_When_Zero
|
|
121 -- parameter is overridden with a True actual parameter value. Using
|
|
122 -- valid picture strings that contain the '*' zero suppression character
|
|
123 -- when this parameter value is True must result in a False result
|
|
124 -- from function Valid. Valid picture strings that do not contain the
|
|
125 -- '*' character should return a function result of True with True
|
|
126 -- provided as the actual parameter to Blank_When_Zero.
|
|
127
|
|
128 -- Check entries 1, 2, 25, 36 from the Valid_Strings array, all of
|
|
129 -- which contain the '*' zero suppression character.
|
|
130
|
|
131 if Editing.Valid(Valid_Strings(1).all, Blank_When_Zero => True) or
|
|
132 Editing.Valid(Valid_Strings(2).all, Blank_When_Zero => True) or
|
|
133 Editing.Valid(Valid_Strings(25).all, Blank_When_Zero => True) or
|
|
134 Editing.Valid(Valid_Strings(36).all, Blank_When_Zero => True)
|
|
135 then
|
|
136 Report.Failed
|
|
137 ("Incorrect result from Function Valid when setting " &
|
|
138 "the value of the Blank_When_Zero parameter to True, " &
|
|
139 "and using picture strings with the '*' character");
|
|
140 end if;
|
|
141
|
|
142
|
|
143 -- Check entries from the Valid_Strings array, none of
|
|
144 -- which contain the '*' zero suppression character.
|
|
145
|
|
146 for i in 3..24 loop
|
|
147
|
|
148 if not Editing.Valid(Pic_String => Valid_Strings(i).all,
|
|
149 Blank_When_Zero => True)
|
|
150 then
|
|
151 Report.Failed("Incorrect result from Function Valid when " &
|
|
152 "setting the value of the Blank_When_Zero " &
|
|
153 "parameter to True, and using picture strings " &
|
|
154 "without the '*' character, Valid_String = " &
|
|
155 FXF3A00.Valid_Strings(i).all);
|
|
156 end if;
|
|
157
|
|
158 end loop;
|
|
159
|
|
160
|
|
161 exception
|
|
162 when others => Report.Failed ("Exception raised in Test_Block");
|
|
163 end Test_Block;
|
|
164
|
|
165 Report.Result;
|
|
166
|
|
167 end CXF3A01;
|