1-- CB40A031.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 predefined exception is correctly propagated from
28--      a private child package through a visible child package to a client.
29--
30-- TEST DESCRIPTION:
31--      Declare two child packages from a root package, one visible, one
32--      private.  The visible child package contains a function, whose
33--      body makes a call to a procedure contained in the private sibling
34--      package.  A predefined exception occurring in the subprogram within the
35--      private package is propagated through the visible sibling and ancestor
36--      to the 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--         CB40A030.A
54--      => CB40A031.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
63with Report;
64with FB40A00.CB40A030_0; -- Explicit "with" of Text_Parser.Character_Counting
65                         -- Implicit "with" of Text_Parser
66
67procedure CB40A031 is
68
69   String_Constant : constant String :=
70     "The San Diego Padres will win the World Series in 1999.";
71
72   Number_Of_AlphaNumeric_Characters : Natural := 0;
73
74begin
75
76   Process_Block:
77   begin
78
79      Report.Test ("CB40A031", "Check that a predefined exception " &
80                               "is correctly propagated across "    &
81                               "package boundaries");
82
83      Number_Of_AlphaNumeric_Characters :=
84        FB40A00.CB40A030_0.Count_AlphaNumerics (String_Constant);
85
86      Report.Failed ("Exception should have been handled");
87
88   exception
89
90      when Constraint_Error =>                       -- Correct exception
91         if FB40A00.AlphaNumeric_Count /= 44 then    -- propagation.
92            Report.Failed ("Incorrect string processing");
93         end if;
94
95      when others =>
96         Report.Failed ("Exception handled in an others handler");
97
98   end Process_Block;
99
100   Report.Result;
101
102end CB40A031;
103