OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c5/] [c54a07a.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C54A07A.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 VARIABLE USED AS A CASE EXPRESSION IS NOT CONSIDERED
26
--    LOCAL TO THE CASE STATEMENT.  IN PARTICULAR, CHECK THAT THE
27
--    VARIABLE CAN BE ASSIGNED A NEW VALUE, AND THE ASSIGNMENT TAKES
28
--    EFFECT IMMEDIATELY (I.E. THE CASE STATEMENT DOES NOT USE A
29
--    COPY OF THE CASE EXPRESSION).
30
 
31
 
32
-- RM 01/21/80
33
 
34
 
35
WITH REPORT ;
36
PROCEDURE  C54A07A  IS
37
 
38
     USE REPORT ;
39
 
40
BEGIN
41
 
42
     TEST("C54A07A" , "CHECK THAT A VARIABLE USED AS A CASE" &
43
                      " EXPRESSION IS NOT CONSIDERED LOCAL TO" &
44
                      " THE CASE STATEMENT" );
45
 
46
     DECLARE   -- A
47
     BEGIN
48
 
49
B1 :      DECLARE
50
 
51
               TYPE  VARIANT_REC( DISCR : BOOLEAN := TRUE )  IS
52
                    RECORD
53
                         A , B : INTEGER ;
54
                         CASE  DISCR  IS
55
                              WHEN  TRUE   =>  P , Q : CHARACTER ;
56
                              WHEN  FALSE  =>  X , Y : INTEGER   ;
57
                         END CASE;
58
                    END RECORD ;
59
 
60
               V : VARIANT_REC := ( TRUE , 1 , 2 ,
61
                                           IDENT_CHAR( 'P' )   ,
62
                                           IDENT_CHAR( 'Q' )   );
63
 
64
          BEGIN
65
 
66
               IF  EQUAL( 3 , 7 )  THEN  V := ( FALSE , 3 , 4 , 7 , 8 );
67
               END IF;
68
 
69
               CASE  V.DISCR  IS
70
 
71
                    WHEN  TRUE    =>
72
 
73
                         IF  ( V.P /= 'P'  OR
74
                               V.Q /= 'Q'  )
75
                         THEN  FAILED( "WRONG VALUES  -  1" );
76
                         END IF;
77
 
78
                         B1.V  :=  ( FALSE , 3 , 4 ,
79
                                             IDENT_INT( 5 )   ,
80
                                             IDENT_INT( 6 )   );
81
 
82
                         IF  V.DISCR  THEN FAILED( "WRONG DISCR." );
83
                         END IF;
84
 
85
                         IF  ( V.X /= 5  OR
86
                               V.Y /= 6  )
87
                         THEN  FAILED( "WRONG VALUES  -  2" );
88
                         END IF;
89
 
90
                    WHEN  FALSE   =>
91
                         FAILED( "WRONG BRANCH IN CASE STMT." );
92
 
93
               END CASE;
94
 
95
          EXCEPTION
96
 
97
               WHEN  OTHERS  =>  FAILED("EXCEPTION RAISED");
98
 
99
          END B1 ;
100
 
101
     EXCEPTION
102
 
103
          WHEN  OTHERS  =>  FAILED( "EXCEPTION RAISED BY DECLARATIONS");
104
 
105
     END ;    -- A
106
 
107
 
108
     RESULT ;
109
 
110
 
111
END C54A07A ;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.