OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c4/] [c43108a.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C43108A.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
-- OBJECTIVE:
26
--     CHECK THAT IN A RECORD AGGREGATE THE VALUE OF A DISCRIMINANT IS
27
--     USED TO RESOLVE THE TYPE OF A COMPONENT THAT DEPENDS ON THE
28
--     DISCRIMINANT.
29
 
30
-- HISTORY:
31
--     DHH 09/08/88  CREATED ORIGINAL TEST.
32
 
33
WITH REPORT; USE REPORT;
34
PROCEDURE C43108A IS
35
 
36
BEGIN
37
     TEST ("C43108A", "CHECK THAT IN A RECORD AGGREGATE THE VALUE OF " &
38
                      "A DISCRIMINANT IS USED TO RESOLVE THE TYPE OF " &
39
                      "A COMPONENT THAT DEPENDS ON THE DISCRIMINANT");
40
 
41
     DECLARE
42
          A : INTEGER;
43
 
44
          TYPE DIS(A : BOOLEAN) IS
45
               RECORD
46
                    CASE A IS
47
                         WHEN TRUE =>
48
                              B : BOOLEAN;
49
                              C : INTEGER;
50
                         WHEN FALSE =>
51
                              D : INTEGER;
52
                    END CASE;
53
               END RECORD;
54
 
55
          FUNCTION DIFF(PARAM : DIS) RETURN INTEGER IS
56
          BEGIN
57
               IF PARAM.B THEN
58
                    RETURN PARAM.C;
59
               ELSE
60
                    RETURN PARAM.D;
61
               END IF;
62
          END DIFF;
63
 
64
     BEGIN
65
          A := DIFF((C => 3, OTHERS => TRUE));
66
 
67
          IF A /= IDENT_INT(3) THEN
68
               FAILED("STATIC OTHERS NOT DECIDED CORRECTLY");
69
          END IF;
70
     END;
71
 
72
     DECLARE
73
          GLOBAL : INTEGER := 0;
74
          TYPE INT IS NEW INTEGER;
75
 
76
          TYPE DIS(A : BOOLEAN) IS
77
               RECORD
78
                    CASE A IS
79
                         WHEN TRUE =>
80
                              I1 : INT;
81
                         WHEN FALSE =>
82
                              I2 : INTEGER;
83
                    END CASE;
84
               END RECORD;
85
          FUNCTION F RETURN INT;
86
          FUNCTION F RETURN INTEGER;
87
 
88
          A : DIS(TRUE);
89
 
90
          FUNCTION F RETURN INT IS
91
          BEGIN
92
               GLOBAL := 1;
93
               RETURN 5;
94
          END F;
95
 
96
          FUNCTION F RETURN INTEGER IS
97
          BEGIN
98
               GLOBAL := 2;
99
               RETURN 5;
100
          END F;
101
 
102
     BEGIN
103
          A := (TRUE, OTHERS => F);
104
 
105
          IF GLOBAL /= 1 THEN
106
               FAILED("NON_STATIC OTHERS NOT DECIDED CORRECTLY");
107
          END IF;
108
     END;
109
 
110
     RESULT;
111
END C43108A;

powered by: WebSVN 2.1.0

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