1--  C55B04A.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-- CHECK THAT A LOOP IS NOT ENTERED IF THE LOWER BOUND OF THE DISCRETE
26--   RANGE IS GREATER THAN THE UPPER BOUND, WHETHER REVERSE IS PRESENT
27--   OR NOT.
28
29-- CHECK THAT LOOP BOUNDS ARE EVALUATED ONLY ONCE, UPON ENTRY TO
30--   THE LOOP.
31
32-- DAS  01/12/81
33-- SPS 3/2/83
34-- JBG 8/21/83
35
36WITH REPORT;
37PROCEDURE C55B04A IS
38
39     USE REPORT;
40
41     C10 : CONSTANT INTEGER := 10;
42     I10 : INTEGER;
43
44BEGIN
45     TEST ( "C55B04A", "CHECK OPERATION OF A FOR LOOP OVER A NULL " &
46                       "DISCRETE RANGE" );
47
48     -- NOTE: EXIT STATEMENTS ARE INCLUDED TO AID IN RECOVERY FROM
49     --   TEST FAILURE.
50
51     -- SUBTESTS INVOLVING STATIC BOUNDS:
52
53     FOR I IN 10..1 LOOP
54          FAILED ( "LOOPING OVER NULL RANGE 10..1" );
55          EXIT;
56     END LOOP;
57
58     FOR I IN REVERSE INTEGER RANGE -1..-10 LOOP
59          FAILED ( "LOOPING OVER NULL RANGE -1..-10" );
60          EXIT;
61     END LOOP;
62
63     FOR I IN (C10 + 3)..(-3 * C10 + 27) LOOP     -- 13..-3
64          FAILED ("LOOPING OVER NULL RANGE (C10 + 3)..(-3 * C10 + 27)");
65          EXIT;
66     END LOOP;
67
68
69     -- SUBTESTS INVOLVING DYNAMIC BOUNDS:
70
71     I10 := IDENT_INT(10);
72
73     FOR I IN REVERSE I10..(I10-1) LOOP           -- 10..9
74          FAILED ( "LOOPING OVER NULL RANGE I10..(I10-1)");
75          EXIT;
76     END LOOP;
77
78
79     FOR I IN (C10 - I10)..(I10 - 11) LOOP        -- 0..-1
80          FAILED ( "LOOPING OVER NULL RANGE (C10 - I10)..(I10 - 11)" );
81          EXIT;
82     END LOOP;
83
84
85     -- SUBTEST OF BOUNDS EVALUTION ONLY AT ENTRY:
86
87     FOR I IN 1..I10 LOOP
88          I10 := I10 - 1;
89     END LOOP;
90     IF (I10 /= 0) THEN
91          FAILED ( "LOOP BOUNDS NOT FIXED AT LOOP ENTRY" );
92     END IF;
93
94     RESULT;
95
96END C55B04A;
97