1 |
720 |
jeremybenn |
-- C54A42C.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 CASE_STATEMENT CORRECTLY HANDLES A SPARSE SET OF
|
26 |
|
|
-- POTENTIAL VALUES (OF TYPE INTEGER) IN A LARGE RANGE.
|
27 |
|
|
|
28 |
|
|
-- (OPTIMIZATION TEST)
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
-- RM 03/26/81
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
WITH REPORT;
|
35 |
|
|
PROCEDURE C54A42C IS
|
36 |
|
|
|
37 |
|
|
USE REPORT ;
|
38 |
|
|
|
39 |
|
|
BEGIN
|
40 |
|
|
|
41 |
|
|
TEST( "C54A42C" , "TEST THAT A CASE_STATEMENT HANDLES CORRECTLY" &
|
42 |
|
|
" A SPARSE SET OF POTENTIAL VALUES IN A LARGE" &
|
43 |
|
|
" RANGE" );
|
44 |
|
|
|
45 |
|
|
DECLARE
|
46 |
|
|
|
47 |
|
|
NUMBER : CONSTANT := 1001 ;
|
48 |
|
|
LITEXPR : CONSTANT := NUMBER + 998 ;
|
49 |
|
|
STATCON : CONSTANT INTEGER RANGE 1..INTEGER'LAST := 1000 ;
|
50 |
|
|
DYNVAR : INTEGER RANGE 1..INTEGER'LAST :=
|
51 |
|
|
IDENT_INT( INTEGER'LAST-50 );
|
52 |
|
|
DYNCON : CONSTANT INTEGER RANGE 1..INTEGER'LAST :=
|
53 |
|
|
IDENT_INT( 1000 );
|
54 |
|
|
|
55 |
|
|
BEGIN
|
56 |
|
|
|
57 |
|
|
CASE INTEGER'( NUMBER ) IS
|
58 |
|
|
WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE F1");
|
59 |
|
|
WHEN 1000 => FAILED("WRONG ALTERNATIVE F2");
|
60 |
|
|
WHEN 2000 => FAILED("WRONG ALTERNATIVE F3");
|
61 |
|
|
WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE F4");
|
62 |
|
|
WHEN INTEGER'LAST-100 ..
|
63 |
|
|
INTEGER'LAST => FAILED("WRONG ALTERNATIVE F5");
|
64 |
|
|
WHEN OTHERS => NULL ;
|
65 |
|
|
END CASE;
|
66 |
|
|
|
67 |
|
|
CASE IDENT_INT( 10 ) IS
|
68 |
|
|
WHEN 1 .. 10 => NULL ;
|
69 |
|
|
WHEN 1000 => FAILED("WRONG ALTERNATIVE G2");
|
70 |
|
|
WHEN 2000 => FAILED("WRONG ALTERNATIVE G3");
|
71 |
|
|
WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE G4");
|
72 |
|
|
WHEN INTEGER'LAST -100 ..
|
73 |
|
|
INTEGER'LAST => FAILED("WRONG ALTERNATIVE G5");
|
74 |
|
|
WHEN OTHERS => FAILED("WRONG ALTERNATIVE G6");
|
75 |
|
|
END CASE;
|
76 |
|
|
|
77 |
|
|
CASE IDENT_INT(LITEXPR) IS
|
78 |
|
|
WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE H1");
|
79 |
|
|
WHEN 1000 => FAILED("WRONG ALTERNATIVE H2");
|
80 |
|
|
WHEN 2000 => FAILED("WRONG ALTERNATIVE H3");
|
81 |
|
|
WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE H4");
|
82 |
|
|
WHEN INTEGER'LAST -100 ..
|
83 |
|
|
INTEGER'LAST => FAILED("WRONG ALTERNATIVE H5");
|
84 |
|
|
WHEN OTHERS => NULL ;
|
85 |
|
|
END CASE;
|
86 |
|
|
|
87 |
|
|
CASE STATCON IS
|
88 |
|
|
WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE I1");
|
89 |
|
|
WHEN 1000 => NULL ;
|
90 |
|
|
WHEN 2000 => FAILED("WRONG ALTERNATIVE I3");
|
91 |
|
|
WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE I4");
|
92 |
|
|
WHEN INTEGER'LAST -100 ..
|
93 |
|
|
INTEGER'LAST => FAILED("WRONG ALTERNATIVE I5");
|
94 |
|
|
WHEN OTHERS => FAILED("WRONG ALTERNATIVE I6");
|
95 |
|
|
END CASE;
|
96 |
|
|
|
97 |
|
|
CASE DYNVAR IS
|
98 |
|
|
WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE J1");
|
99 |
|
|
WHEN 1000 => FAILED("WRONG ALTERNATIVE J2");
|
100 |
|
|
WHEN 2000 => FAILED("WRONG ALTERNATIVE J3");
|
101 |
|
|
WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE J4");
|
102 |
|
|
WHEN INTEGER'LAST -100 ..
|
103 |
|
|
INTEGER'LAST => NULL ;
|
104 |
|
|
WHEN OTHERS => FAILED("WRONG ALTERNATIVE J6");
|
105 |
|
|
END CASE;
|
106 |
|
|
|
107 |
|
|
CASE DYNCON IS
|
108 |
|
|
WHEN 1 .. 10 => FAILED("WRONG ALTERNATIVE K1");
|
109 |
|
|
WHEN 1000 => NULL ;
|
110 |
|
|
WHEN 2000 => FAILED("WRONG ALTERNATIVE K3");
|
111 |
|
|
WHEN 4000 .. 4100 => FAILED("WRONG ALTERNATIVE K4");
|
112 |
|
|
WHEN INTEGER'LAST -100 ..
|
113 |
|
|
INTEGER'LAST => FAILED("WRONG ALTERNATIVE K5");
|
114 |
|
|
WHEN OTHERS => FAILED("WRONG ALTERNATIVE K6");
|
115 |
|
|
END CASE;
|
116 |
|
|
|
117 |
|
|
END ;
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
RESULT ;
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
END C54A42C ;
|