annotate gcc/testsuite/ada/acats/tests/ca/ca11c01.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- CA11C01.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- OBJECTIVE:
kono
parents:
diff changeset
27 -- Check that when primitive operations declared in a child package
kono
parents:
diff changeset
28 -- override operations declared in ancestor packages, a client of the
kono
parents:
diff changeset
29 -- child package inherits the operations correctly.
kono
parents:
diff changeset
30 --
kono
parents:
diff changeset
31 -- TEST DESCRIPTION:
kono
parents:
diff changeset
32 --
kono
parents:
diff changeset
33 -- This test builds on the foundation code file (FA11C00) that contains
kono
parents:
diff changeset
34 -- a parent package, child package, and grandchild package. The parent
kono
parents:
diff changeset
35 -- package declares a tagged type and primitive operation. The child
kono
parents:
diff changeset
36 -- package extends the type, and overrides the primitive operation. The
kono
parents:
diff changeset
37 -- grandchild package does the same.
kono
parents:
diff changeset
38 --
kono
parents:
diff changeset
39 -- The test procedure "withs" the grandchild package, and receives
kono
parents:
diff changeset
40 -- visibility to all of its ancestor packages, types and operations.
kono
parents:
diff changeset
41 -- Three procedures, each with a formal parameter of a specific type are
kono
parents:
diff changeset
42 -- defined. Each of these invokes a particular version of the overridden
kono
parents:
diff changeset
43 -- primitive operation Image. Calls to these local procedures are made,
kono
parents:
diff changeset
44 -- with objects of each of the tagged types as parameters, and the global
kono
parents:
diff changeset
45 -- variable is finally examined to ensure that the correct version of
kono
parents:
diff changeset
46 -- primitive operation was inherited by the client and invoked by the
kono
parents:
diff changeset
47 -- call.
kono
parents:
diff changeset
48 --
kono
parents:
diff changeset
49 -- TEST FILES:
kono
parents:
diff changeset
50 -- This test depends on the following foundation code:
kono
parents:
diff changeset
51 --
kono
parents:
diff changeset
52 -- FA11C00.A
kono
parents:
diff changeset
53 --
kono
parents:
diff changeset
54 --
kono
parents:
diff changeset
55 -- CHANGE HISTORY:
kono
parents:
diff changeset
56 -- 06 Dec 94 SAIC ACVC 2.0
kono
parents:
diff changeset
57 --
kono
parents:
diff changeset
58 --!
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 with FA11C00_0.FA11C00_1.FA11C00_2; -- Package Animal.Mammal.Primate
kono
parents:
diff changeset
61 with Report;
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 procedure CA11C01 is
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 package Animal_Package renames FA11C00_0;
kono
parents:
diff changeset
66 package Mammal_Package renames FA11C00_0.FA11C00_1;
kono
parents:
diff changeset
67 package Primate_Package renames FA11C00_0.FA11C00_1.FA11C00_2;
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 Max_Animals : constant := 3;
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 subtype Data_String is String (1 .. 37);
kono
parents:
diff changeset
72 type Data_Base_Type is array (1 .. Max_Animals) of Data_String;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 Zoo_Data_Base : Data_Base_Type := (others => (others => ' '));
kono
parents:
diff changeset
75 -- Global variable.
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 Salmon : Animal_Package.Animal := (Common_Name => "Chinook Salmon ",
kono
parents:
diff changeset
78 Weight => 10);
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 Platypus : Mammal_Package.Mammal := (Common_Name => "Tasmanian Platypus ",
kono
parents:
diff changeset
81 Weight => 13,
kono
parents:
diff changeset
82 Hair_Color => Mammal_Package.Brown);
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 Orangutan : Primate_Package.Primate :=
kono
parents:
diff changeset
85 (Common_Name => "Sumatran Orangutan ",
kono
parents:
diff changeset
86 Weight => 220,
kono
parents:
diff changeset
87 Hair_Color => Mammal_Package.Red,
kono
parents:
diff changeset
88 Habitat => Primate_Package.Arboreal);
kono
parents:
diff changeset
89 begin
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 Report.Test ("CA11C01", "Check that when primitive operations declared " &
kono
parents:
diff changeset
92 "in a child package override operations declared " &
kono
parents:
diff changeset
93 "in ancestor packages, a client of the child " &
kono
parents:
diff changeset
94 "package inherits the operations correctly");
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 declare
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 use Animal_Package, Mammal_Package, Primate_Package;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 -- The function Image has been overridden in the child and grandchild
kono
parents:
diff changeset
101 -- packages, but the client has inherited all versions of the function,
kono
parents:
diff changeset
102 -- and can successfully use them to enter data into the database.
kono
parents:
diff changeset
103 -- Each of the following procedures updates the global variable
kono
parents:
diff changeset
104 -- Zoo_Data_Base.
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 procedure Enter_Animal_Data (A : Animal; I : Integer) is
kono
parents:
diff changeset
107 begin
kono
parents:
diff changeset
108 Zoo_Data_Base (I) := Image (A);
kono
parents:
diff changeset
109 end Enter_Animal_Data;
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 procedure Enter_Mammal_Data (M : Mammal; I : Integer) is
kono
parents:
diff changeset
112 begin
kono
parents:
diff changeset
113 Zoo_Data_Base (I) := Image (M);
kono
parents:
diff changeset
114 end Enter_Mammal_Data;
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 procedure Enter_Primate_Data (P : Primate; I : Integer) is
kono
parents:
diff changeset
117 begin
kono
parents:
diff changeset
118 Zoo_Data_Base (I) := Image (P);
kono
parents:
diff changeset
119 end Enter_Primate_Data;
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 begin
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 -- Verify initial test conditions.
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 if not (Zoo_Data_Base(1)(1..6) = " ")
kono
parents:
diff changeset
126 or else
kono
parents:
diff changeset
127 (Zoo_Data_Base(2)(1..6) /= " ")
kono
parents:
diff changeset
128 or else
kono
parents:
diff changeset
129 (Zoo_Data_Base(3)(1..6) /= " ")
kono
parents:
diff changeset
130 then
kono
parents:
diff changeset
131 Report.Failed ("Initial condition failure");
kono
parents:
diff changeset
132 end if;
kono
parents:
diff changeset
133
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 -- Enter data from all three animals into the zoo database.
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 Enter_Animal_Data (A => Salmon, I => 1); -- First entry in database.
kono
parents:
diff changeset
138 Enter_Mammal_Data (M => Platypus, I => 2); -- Second entry.
kono
parents:
diff changeset
139 Enter_Primate_Data (P => Orangutan, I => 3); -- Third entry.
kono
parents:
diff changeset
140
kono
parents:
diff changeset
141 -- Verify the correct version of the overridden function Image was used
kono
parents:
diff changeset
142 -- for entering the specific data.
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 if Zoo_Data_Base(1)(1 .. 6) /= "Animal"
kono
parents:
diff changeset
145 or else
kono
parents:
diff changeset
146 Zoo_Data_Base(1)(26 .. 31) /= "Salmon"
kono
parents:
diff changeset
147 then
kono
parents:
diff changeset
148 Report.Failed ("Incorrect version of Image for parent type");
kono
parents:
diff changeset
149 end if;
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 if (Zoo_Data_Base(2)(1 .. 6) /= "Mammal")
kono
parents:
diff changeset
152 or
kono
parents:
diff changeset
153 (Zoo_Data_Base(2)(28 .. 35) /= "Platypus")
kono
parents:
diff changeset
154 then
kono
parents:
diff changeset
155 Report.Failed ("Incorrect version of Image for child type");
kono
parents:
diff changeset
156 end if;
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 if ((Zoo_Data_Base(3)(1 .. 7) /= "Primate")
kono
parents:
diff changeset
159 or
kono
parents:
diff changeset
160 (Zoo_Data_Base(3)(27 .. 35) /= "Orangutan"))
kono
parents:
diff changeset
161 then
kono
parents:
diff changeset
162 Report.Failed ("Incorrect version of Image for grandchild type");
kono
parents:
diff changeset
163 end if;
kono
parents:
diff changeset
164
kono
parents:
diff changeset
165 end;
kono
parents:
diff changeset
166
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168 Report.Result;
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 end CA11C01;