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