1 |
720 |
jeremybenn |
-- C54A42G.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 SEVERAL NON-CONTIGUOUS
|
26 |
|
|
-- RANGES OF INTEGERS COVERED BY A SINGLE 'OTHERS' ALTERNATIVE.
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
-- (OPTIMIZATION TEST.)
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
-- RM 03/30/81
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
WITH REPORT;
|
36 |
|
|
PROCEDURE C54A42G IS
|
37 |
|
|
|
38 |
|
|
USE REPORT ;
|
39 |
|
|
|
40 |
|
|
BEGIN
|
41 |
|
|
|
42 |
|
|
TEST( "C54A42G" , "TEST THAT A CASE_STATEMENT CORRECTLY HANDLES" &
|
43 |
|
|
" SEVERAL NON-CONTIGUOUS RANGES OF INTEGERS" &
|
44 |
|
|
" COVERED BY A SINGLE 'OTHERS' ALTERNATIVE" );
|
45 |
|
|
|
46 |
|
|
DECLARE
|
47 |
|
|
|
48 |
|
|
NUMBER : CONSTANT := 2000 ;
|
49 |
|
|
LITEXPR : CONSTANT := NUMBER + 2000 ;
|
50 |
|
|
STATCON : CONSTANT INTEGER := 2002 ;
|
51 |
|
|
DYNVAR : INTEGER := IDENT_INT( 0 );
|
52 |
|
|
DYNCON : CONSTANT INTEGER := IDENT_INT( 1 );
|
53 |
|
|
|
54 |
|
|
BEGIN
|
55 |
|
|
|
56 |
|
|
CASE INTEGER'(-4000) IS
|
57 |
|
|
WHEN 100..1999 => FAILED("WRONG ALTERNATIVE F1");
|
58 |
|
|
WHEN INTEGER'FIRST..0=> NULL ;
|
59 |
|
|
WHEN 2001 => FAILED("WRONG ALTERNATIVE F3");
|
60 |
|
|
WHEN 2100..INTEGER'LAST=>FAILED("WRONG ALTERNATIVE F4");
|
61 |
|
|
WHEN OTHERS => FAILED("WRONG ALTERNATIVE F5");
|
62 |
|
|
END CASE;
|
63 |
|
|
|
64 |
|
|
CASE IDENT_INT(NUMBER) IS
|
65 |
|
|
WHEN 100..1999 => FAILED("WRONG ALTERNATIVE G1");
|
66 |
|
|
WHEN INTEGER'FIRST..0=> FAILED("WRONG ALTERNATIVE G2");
|
67 |
|
|
WHEN 2001 => FAILED("WRONG ALTERNATIVE G3");
|
68 |
|
|
WHEN 2100..INTEGER'LAST=>FAILED("WRONG ALTERNATIVE G4");
|
69 |
|
|
WHEN OTHERS => NULL ;
|
70 |
|
|
END CASE;
|
71 |
|
|
|
72 |
|
|
CASE IDENT_INT(LITEXPR) IS
|
73 |
|
|
WHEN 100..1999 => FAILED("WRONG ALTERNATIVE H1");
|
74 |
|
|
WHEN INTEGER'FIRST..0=> FAILED("WRONG ALTERNATIVE H2");
|
75 |
|
|
WHEN 2001 => FAILED("WRONG ALTERNATIVE H3");
|
76 |
|
|
WHEN 2100..INTEGER'LAST=>NULL ;
|
77 |
|
|
WHEN OTHERS => FAILED("WRONG ALTERNATIVE H5");
|
78 |
|
|
END CASE;
|
79 |
|
|
|
80 |
|
|
CASE IDENT_INT(STATCON) IS
|
81 |
|
|
WHEN 100..1999 => FAILED("WRONG ALTERNATIVE I1");
|
82 |
|
|
WHEN INTEGER'FIRST..0=> FAILED("WRONG ALTERNATIVE I2");
|
83 |
|
|
WHEN 2001 => FAILED("WRONG ALTERNATIVE I3");
|
84 |
|
|
WHEN 2100..INTEGER'LAST=>FAILED("WRONG ALTERNATIVE I4");
|
85 |
|
|
WHEN OTHERS => NULL ;
|
86 |
|
|
END CASE;
|
87 |
|
|
|
88 |
|
|
CASE DYNVAR IS
|
89 |
|
|
WHEN 100..1999 => FAILED("WRONG ALTERNATIVE J1");
|
90 |
|
|
WHEN INTEGER'FIRST..0=> NULL ;
|
91 |
|
|
WHEN 2001 => FAILED("WRONG ALTERNATIVE J3");
|
92 |
|
|
WHEN 2100..INTEGER'LAST=>FAILED("WRONG ALTERNATIVE J4");
|
93 |
|
|
WHEN OTHERS => FAILED("WRONG ALTERNATIVE J5");
|
94 |
|
|
END CASE;
|
95 |
|
|
|
96 |
|
|
CASE DYNCON IS
|
97 |
|
|
WHEN 100..1999 => FAILED("WRONG ALTERNATIVE K1");
|
98 |
|
|
WHEN INTEGER'FIRST..0=> FAILED("WRONG ALTERNATIVE K2");
|
99 |
|
|
WHEN 2001 => FAILED("WRONG ALTERNATIVE K3");
|
100 |
|
|
WHEN 2100..INTEGER'LAST=>FAILED("WRONG ALTERNATIVE K4");
|
101 |
|
|
WHEN OTHERS => NULL ;
|
102 |
|
|
END CASE;
|
103 |
|
|
|
104 |
|
|
CASE IDENT_INT( -3900 ) IS
|
105 |
|
|
WHEN -3000..1999 => FAILED("WRONG ALTERNATIVE X1");
|
106 |
|
|
WHEN INTEGER'FIRST..
|
107 |
|
|
-4000 => FAILED("WRONG ALTERNATIVE X2");
|
108 |
|
|
WHEN 2001 => FAILED("WRONG ALTERNATIVE X3");
|
109 |
|
|
WHEN 2100..INTEGER'LAST=>FAILED("WRONG ALTERNATIVE X4");
|
110 |
|
|
WHEN OTHERS => NULL ;
|
111 |
|
|
END CASE;
|
112 |
|
|
|
113 |
|
|
END ;
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
RESULT ;
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
END C54A42G ;
|