Debian Codegraph @

gcc/testsuite/ada/acats/tests/cb/cb40a021.am

raw
1 -- CB40A021.AM
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 a user defined exception is correctly propagated from a
28 -- private child subprogram to its parent and then to a client of the
29 -- parent.
30 --
31 -- TEST DESCRIPTION:
32 -- Declare a child package containing a function. The body of the
33 -- function contains a call to a private child subprogram (child of
34 -- the child). The private child subprogram raises an exception
35 -- defined in the root ancestor package, and it is propagated to the
36 -- test program.
37 --
38 -- Exception Type Raised:
39 -- * User Defined
40 -- Predefined
41 --
42 -- Hierarchical Structure Employed For This Test:
43 -- * Parent Package
44 -- * Visible Child Package
45 -- Private Child Package
46 -- Visible Child Subprogram
47 -- * Private Child Subprogram
48 --
49 -- TEST FILES:
50 -- This test consists of the following files:
51 --
52 -- FB40A00.A
53 -- CB40A020.A
54 -- => CB40A021.AM
55 --
56 --
57 -- CHANGE HISTORY:
58 -- 06 Dec 94 SAIC ACVC 2.0
59 -- 02 Nov 96 SAIC ACVC 2.1: Modified prologue.
60 --
61 --!
62
63
64 with Report;
65 with FB40A00.CB40A020_0; -- Explicit "with" of Text_Parser.Processing
66 -- Implicit "with" of Text_Parser (FB40A00)
67
68 procedure CB40A021 is
69
70 String_Constant : constant String :=
71 "ACVC Version 2.0 will incorporate Ada 9X feature tests.";
72
73 Number_Of_AlphaNumeric_Characters : Natural := 0;
74
75 begin
76
77 Process_Block:
78 begin
79
80 Report.Test ("CB40A021", "Check that a user defined exception " &
81 "is correctly propagated across " &
82 "package and subprogram boundaries");
83
84 Number_Of_AlphaNumeric_Characters :=
85 FB40A00.CB40A020_0.Count_AlphaNumerics (String_Constant);
86
87 Report.Failed ("Exception should have been handled");
88
89 exception
90
91 when FB40A00.Completed_Text_Processing => -- Correct exception
92 if FB40A00.AlphaNumeric_Count /= 45 then -- propagation.
93 Report.Failed ("Incorrect string processing");
94 end if;
95
96 when others =>
97 Report.Failed ("Exception handled in an others handler");
98
99 end Process_Block;
100
101 Report.Result;
102
103 end CB40A021;