1 |
294 |
jeremybenn |
-- CD2B15C.ADA
|
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 |
|
|
-- OBJECTIVE:
|
26 |
|
|
-- IF THE COLLECTION SIZE IS LARGE ENOUGH TO HOLD SOME
|
27 |
|
|
-- VALUES OF THE DESIGNATED TYPE, CHECK THAT "STORAGE_ERROR"
|
28 |
|
|
-- IS RAISED BY AN ALLOCATOR WHEN INSUFFICIENT STORAGE IS
|
29 |
|
|
-- AVAILABLE.
|
30 |
|
|
|
31 |
|
|
-- HISTORY:
|
32 |
|
|
-- DHH 09/23/87 CREATED ORIGINAL TEST.
|
33 |
|
|
-- PMW 09/19/88 MODIFIED WITHDRAWN TEST.
|
34 |
|
|
-- THS 03/21/90 CHANGED EXTENSION FROM '.DEP' TO '.ADA' AND
|
35 |
|
|
-- COMPLETELY REVISED THE TEST TO PREVENT OPTIMIZATION.
|
36 |
|
|
-- LDC 09/20/90 REMOVED UNUSED VARIABLE, CHANGED FAIL CALLS TO
|
37 |
|
|
-- COMMENT FOR 'STORAGE_SIZE /= TO SPECIFIED SIZE,
|
38 |
|
|
-- MOVED LOOP FOR CHECK VALUES TO EXCEPTION HANDLER.
|
39 |
|
|
|
40 |
|
|
WITH REPORT; USE REPORT;
|
41 |
|
|
WITH SYSTEM;
|
42 |
|
|
PROCEDURE CD2B15C IS
|
43 |
|
|
|
44 |
|
|
SPECIFIED_SIZE : CONSTANT := 1000;
|
45 |
|
|
|
46 |
|
|
TYPE CHECK_TYPE IS ACCESS INTEGER;
|
47 |
|
|
FOR CHECK_TYPE'STORAGE_SIZE USE SPECIFIED_SIZE;
|
48 |
|
|
|
49 |
|
|
UNITS_PER_INTEGER : CONSTANT :=
|
50 |
|
|
(INTEGER'SIZE + SYSTEM.STORAGE_UNIT - 1) / SYSTEM.STORAGE_UNIT;
|
51 |
|
|
|
52 |
|
|
TYPE ACC_ARRAY_TYPE IS ARRAY
|
53 |
|
|
(INTEGER RANGE 1 .. (CHECK_TYPE'STORAGE_SIZE /
|
54 |
|
|
UNITS_PER_INTEGER) + 1) OF CHECK_TYPE;
|
55 |
|
|
ACC_ARRAY : ACC_ARRAY_TYPE;
|
56 |
|
|
|
57 |
|
|
PLACE_I_STOPPED : INTEGER := 0;
|
58 |
|
|
|
59 |
|
|
BEGIN
|
60 |
|
|
|
61 |
|
|
TEST ("CD2B15C", "IF THE COLLECTION SIZE IS LARGE " &
|
62 |
|
|
"ENOUGH TO HOLD SOME VALUES OF " &
|
63 |
|
|
"THE DESIGNATED TYPE, CHECK THAT " &
|
64 |
|
|
"STORAGE_ERROR IS RAISED BY AN " &
|
65 |
|
|
"ALLOCATOR WHEN INSUFFICIENT STORAGE " &
|
66 |
|
|
"IS AVAILABLE");
|
67 |
|
|
|
68 |
|
|
IF CHECK_TYPE'STORAGE_SIZE < IDENT_INT (SPECIFIED_SIZE) THEN
|
69 |
|
|
FAILED ("CHECK_TYPE'STORAGE_SIZE IS LESS THEN THE VALUE " &
|
70 |
|
|
"SPECIFIED IN THE REPRESENTATION CLAUSE");
|
71 |
|
|
|
72 |
|
|
ELSIF CHECK_TYPE'STORAGE_SIZE > 2 * IDENT_INT (SPECIFIED_SIZE) THEN
|
73 |
|
|
COMMENT ("VALUE FOR CHECK_TYPE'STORAGE_SIZE IS MORE THEN " &
|
74 |
|
|
"TWICE THE SPECIFIED VALUE IN THE REPRESENTATION " &
|
75 |
|
|
"CLAUSE");
|
76 |
|
|
END IF;
|
77 |
|
|
|
78 |
|
|
BEGIN
|
79 |
|
|
|
80 |
|
|
FOR I IN ACC_ARRAY'RANGE LOOP
|
81 |
|
|
ACC_ARRAY (I) := NEW INTEGER'(IDENT_INT (I));
|
82 |
|
|
PLACE_I_STOPPED := I;
|
83 |
|
|
END LOOP;
|
84 |
|
|
|
85 |
|
|
FAILED ("NO EXCEPTION RAISED WHEN RESERVED SPACE " &
|
86 |
|
|
"EXCEEDED");
|
87 |
|
|
|
88 |
|
|
EXCEPTION
|
89 |
|
|
WHEN STORAGE_ERROR =>
|
90 |
|
|
FOR I IN 1 .. PLACE_I_STOPPED LOOP
|
91 |
|
|
IF ACC_ARRAY (I).ALL /= IDENT_INT (I) THEN
|
92 |
|
|
FAILED ("INCORRECT VALUE FOR ACC_ARRAY (" &
|
93 |
|
|
INTEGER'IMAGE (I) & ")");
|
94 |
|
|
END IF;
|
95 |
|
|
END LOOP;
|
96 |
|
|
WHEN OTHERS =>
|
97 |
|
|
FAILED ("WRONG EXCEPTION RAISED WHEN RESERVED SPACE " &
|
98 |
|
|
"EXCEEDED");
|
99 |
|
|
END;
|
100 |
|
|
|
101 |
|
|
RESULT;
|
102 |
|
|
|
103 |
|
|
END CD2B15C;
|