OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cb/] [cb40a04.a] - Blame information for rev 720

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- CB40A04.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 a predefined exception is correctly propagated out of a
28
--      public child function to a client.
29
--
30
-- TEST DESCRIPTION:
31
--      Declare a public child subprogram.  Define the processing loop
32
--      inside the subprogram to expect a string with index starting at 1.
33
--      From the test procedure, call the child subprogram with a slice
34
--      from the middle of a string variable.  This will cause an exception
35
--      to be raised in the child and propagated to the caller.
36
--
37
--      Exception Type Raised:
38
--          User Defined
39
--        * Predefined
40
--
41
--      Hierarchical Structure Employed For This Test:
42
--        * Parent Package
43
--          Public Child Package
44
--          Private Child Package
45
--        * Public Child Subprogram
46
--          Private Child Subprogram
47
--
48
-- TEST FILES:
49
--      This test depends on the following foundation code:
50
--         FB40A00.A
51
--
52
--
53
-- CHANGE HISTORY:
54
--      06 Dec 94   SAIC    ACVC 2.0
55
--
56
--!
57
 
58
 
59
-- Child subprogram Text_Parser.Count_AlphaNumerics
60
 
61
function FB40A00.CB40A04_0 (Text : string) return Natural is
62
begin
63
 
64
   for I in 1 .. Text'Last loop          -- Raise immediate Constraint_Error
65
      if (Text (I) in 'a'..'z') or       -- with String slice passed from
66
         (Text (I) in 'A'..'Z') or       -- caller. (Slice'first /= 1)
67
         (Text (I) in '0'..'9') then
68
         Increment_AlphaNumeric_Count;
69
      else
70
         Increment_Non_AlphaNumeric_Count;
71
      end if;
72
   end loop;
73
 
74
   return (AlphaNumeric_Count);          -- Global in parent package.
75
 
76
   -- No exception handler here, exception propagates.
77
 
78
end FB40A00.CB40A04_0;
79
 
80
 
81
     --=================================================================--
82
 
83
 
84
with FB40A00.CB40A04_0; -- Explicit "with" of Text_Parser.Count_AlphaNumerics
85
with Report;            -- Implicit "with" of Text_Parser.
86
 
87
procedure CB40A04 is
88
 
89
   String_Var : String (1..19) := "The quick brown fox";
90
 
91
   Number_Of_AlphaNumeric_Characters : Natural := 0;
92
 
93
begin
94
 
95
   Report.Test ("CB40A04", "Check that a predefined exception is " &
96
                           "correctly propagated out of a public " &
97
                           "child function to a client");
98
 
99
   Process_Block:
100
   begin
101
 
102
      Number_Of_AlphaNumeric_Characters :=       -- Provide slice of string
103
        FB40A00.CB40A04_0 (String_Var (5..10));  -- to subprogram.
104
 
105
      Report.Failed ("Exception should have been handled");
106
 
107
   exception
108
 
109
      when Constraint_Error =>                      -- Correct exception
110
         null;                                      -- propagation.
111
 
112
      when others =>
113
         Report.Failed ("Exception handled in an others handler");
114
 
115
   end Process_Block;
116
 
117
   Report.Result;
118
 
119
end CB40A04;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.