annotate gcc/testsuite/ada/acats/tests/c9/c910002.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 -- C910002.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 the contents of a task object include the values
kono
parents:
diff changeset
28 -- of its discriminants.
kono
parents:
diff changeset
29 -- Check that selected_component notation can be used to
kono
parents:
diff changeset
30 -- denote a discriminant of a task.
kono
parents:
diff changeset
31 --
kono
parents:
diff changeset
32 -- TEST DESCRIPTION:
kono
parents:
diff changeset
33 -- This test declares a task type that contains discriminants.
kono
parents:
diff changeset
34 -- Objects of the task type are created with different values.
kono
parents:
diff changeset
35 -- The task type has nested tasks that are used to check that
kono
parents:
diff changeset
36 -- the discriminate values are the expected values.
kono
parents:
diff changeset
37 -- Note that the names of the discriminants in the body of task
kono
parents:
diff changeset
38 -- type DTT denote the current instance of the unit.
kono
parents:
diff changeset
39 --
kono
parents:
diff changeset
40 --
kono
parents:
diff changeset
41 -- CHANGE HISTORY:
kono
parents:
diff changeset
42 -- 12 OCT 95 SAIC Initial release for 2.1
kono
parents:
diff changeset
43 -- 8 MAY 96 SAIC Incorporated Reviewer comments.
kono
parents:
diff changeset
44 --
kono
parents:
diff changeset
45 --!
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 with Report;
kono
parents:
diff changeset
49 procedure C910002 is
kono
parents:
diff changeset
50 Verbose : constant Boolean := False;
kono
parents:
diff changeset
51 begin
kono
parents:
diff changeset
52 Report.Test ("C910002",
kono
parents:
diff changeset
53 "Check that selected_component notation can be" &
kono
parents:
diff changeset
54 " used to access task discriminants");
kono
parents:
diff changeset
55 declare
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 task type DTT
kono
parents:
diff changeset
58 (IA, IB : Integer;
kono
parents:
diff changeset
59 CA, CB : Character) is
kono
parents:
diff changeset
60 entry Check_Values (First_Int : Integer;
kono
parents:
diff changeset
61 First_Char : Character);
kono
parents:
diff changeset
62 end DTT;
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 task body DTT is
kono
parents:
diff changeset
65 Int1 : Integer;
kono
parents:
diff changeset
66 Char1 : Character;
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 -- simple nested task to check the character values
kono
parents:
diff changeset
69 task Check_Chars is
kono
parents:
diff changeset
70 entry Start_Check;
kono
parents:
diff changeset
71 end Check_Chars;
kono
parents:
diff changeset
72 task body Check_Chars is
kono
parents:
diff changeset
73 begin
kono
parents:
diff changeset
74 accept Start_Check;
kono
parents:
diff changeset
75 if DTT.CA /= Char1 or
kono
parents:
diff changeset
76 DTT.CB /= Character'Succ (Char1) then
kono
parents:
diff changeset
77 Report.Failed ("character check failed. Expected: '" &
kono
parents:
diff changeset
78 Char1 & Character'Succ (Char1) &
kono
parents:
diff changeset
79 "' but found '" &
kono
parents:
diff changeset
80 DTT.CA & DTT.CB & "'");
kono
parents:
diff changeset
81 elsif Verbose then
kono
parents:
diff changeset
82 Report.Comment ("char check for " & Char1);
kono
parents:
diff changeset
83 end if;
kono
parents:
diff changeset
84 exception
kono
parents:
diff changeset
85 when others => Report.Failed ("exception in Check_Chars");
kono
parents:
diff changeset
86 end Check_Chars;
kono
parents:
diff changeset
87
kono
parents:
diff changeset
88 -- use a discriminated task to check the integer values
kono
parents:
diff changeset
89 task type Check_Ints (First : Integer);
kono
parents:
diff changeset
90 task body Check_Ints is
kono
parents:
diff changeset
91 begin
kono
parents:
diff changeset
92 if DTT.IA /= Check_Ints.First or
kono
parents:
diff changeset
93 IB /= First+1 then
kono
parents:
diff changeset
94 Report.Failed ("integer check failed. Expected:" &
kono
parents:
diff changeset
95 Integer'Image (Check_Ints.First) &
kono
parents:
diff changeset
96 Integer'Image (First+1) &
kono
parents:
diff changeset
97 " but found" &
kono
parents:
diff changeset
98 Integer'Image (DTT.IA) & Integer'Image (IB) );
kono
parents:
diff changeset
99 elsif Verbose then
kono
parents:
diff changeset
100 Report.Comment ("int check for" & Integer'Image (First));
kono
parents:
diff changeset
101 end if;
kono
parents:
diff changeset
102 exception
kono
parents:
diff changeset
103 when others => Report.Failed ("exception in Check_Ints");
kono
parents:
diff changeset
104 end Check_Ints;
kono
parents:
diff changeset
105 begin
kono
parents:
diff changeset
106 accept Check_Values (First_Int : Integer;
kono
parents:
diff changeset
107 First_Char : Character) do
kono
parents:
diff changeset
108 Int1 := First_Int;
kono
parents:
diff changeset
109 Char1 := First_Char;
kono
parents:
diff changeset
110 end Check_Values;
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 -- kick off the character check
kono
parents:
diff changeset
113 Check_Chars.Start_Check;
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 -- do the integer check
kono
parents:
diff changeset
116 declare
kono
parents:
diff changeset
117 Int_Checker : Check_Ints (Int1);
kono
parents:
diff changeset
118 begin
kono
parents:
diff changeset
119 null; -- let task do its thing
kono
parents:
diff changeset
120 end;
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 -- do one test here too
kono
parents:
diff changeset
123 if DTT.IA /= Int1 then
kono
parents:
diff changeset
124 Report.Failed ("DTT check failed. Expected:" &
kono
parents:
diff changeset
125 Integer'Image (Int1) &
kono
parents:
diff changeset
126 " but found:" &
kono
parents:
diff changeset
127 Integer'Image (DTT.IA));
kono
parents:
diff changeset
128 elsif Verbose then
kono
parents:
diff changeset
129 Report.Comment ("DTT check for" & Integer'Image (Int1));
kono
parents:
diff changeset
130 end if;
kono
parents:
diff changeset
131 exception
kono
parents:
diff changeset
132 when others => Report.Failed ("exception in DTT");
kono
parents:
diff changeset
133 end DTT;
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 T1a : DTT (1, 2, 'a', 'b');
kono
parents:
diff changeset
136 T9C : DTT (9, 10, 'C', 'D');
kono
parents:
diff changeset
137 begin -- test encapsulation
kono
parents:
diff changeset
138 T1a.Check_Values (1, 'a');
kono
parents:
diff changeset
139 T9C.Check_Values (9, 'C');
kono
parents:
diff changeset
140 end;
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 Report.Result;
kono
parents:
diff changeset
143 end C910002;