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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c3/] [c35507n.ada] - Blame information for rev 309

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C35507N.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 THE ATTRIBUTES 'POS' AND 'VAL' YIELD THE CORRECT
27
--     RESULTS WHEN THE PREFIX IS A FORMAL DISCRETE TYPE WHOSE ACTUAL
28
--     PARAMETER IS A CHARACTER TYPE WITH AN ENUMERATION REPRESENTATION
29
--     CLAUSE.
30
 
31
-- HISTORY:
32
--     RJW 06/03/86  CREATED ORIGINAL TEST.
33
--     JET 09/22/87  MADE REPRESENTATION VALUES CONSECUTIVE.
34
--     PWB 05/11/89  CHANGED EXTENSION FROM '.DEP' TO '.ADA'.
35
--     PWN 11/30/94  REMOVED TESTS BASED ON 128 CHARACTERS FOR ADA 9X.
36
 
37
WITH REPORT; USE REPORT;
38
 
39
PROCEDURE  C35507N  IS
40
 
41
     TYPE CHAR IS ('A', B);
42
     FOR CHAR USE ('A' => 4, B => 5);
43
 
44
     TYPE NEWCHAR IS NEW CHAR;
45
 
46
BEGIN
47
 
48
     TEST( "C35507N" , "CHECK THAT THE ATTRIBUTES 'POS' AND " &
49
                       "'VAL' YIELD THE CORRECT RESULTS WHEN THE " &
50
                       "PREFIX IS A FORMAL DISCRETE TYPE WHOSE " &
51
                       "ACTUAL PARAMETER IS A CHARACTER TYPE " &
52
                       "WITH AN ENUMERATION REPRESENTATION CLAUSE" );
53
 
54
     DECLARE
55
          GENERIC
56
               TYPE CHTYPE IS (<>);
57
               STR : STRING;
58
               I1 : INTEGER;
59
          PROCEDURE P;
60
 
61
          PROCEDURE P IS
62
               SUBTYPE SUBCH IS CHTYPE;
63
               CH : CHTYPE;
64
               POSITION : INTEGER;
65
          BEGIN
66
               POSITION := 0;
67
               FOR CH IN CHTYPE LOOP
68
                    IF SUBCH'POS (CH) /= POSITION THEN
69
                         FAILED ( "INCORRECT VALUE FOR " & STR &
70
                                  "'POS OF " & CHTYPE'IMAGE (CH) );
71
                    END IF;
72
 
73
                    IF SUBCH'VAL (POSITION) /= CH THEN
74
                         FAILED ( "INCORRECT VALUE FOR " & STR &
75
                                  "'VAL OF CHARACTER IN POSITION - " &
76
                                    INTEGER'IMAGE (POSITION) );
77
                    END IF;
78
                    POSITION := POSITION + 1;
79
               END LOOP;
80
 
81
               BEGIN
82
                    IF SUBCH'VAL (-1) = SUBCH'VAL (0) THEN
83
                         FAILED ( "NO EXCEPTION RAISED " &
84
                                  "FOR " & STR & "'VAL (-1) - 1" );
85
                    ELSE
86
                         FAILED ( "NO EXCEPTION RAISED " &
87
                                  "FOR " & STR & "'VAL (-1) - 2" );
88
                    END IF;
89
               EXCEPTION
90
                    WHEN CONSTRAINT_ERROR =>
91
                         NULL;
92
                    WHEN OTHERS =>
93
                         FAILED ( "WRONG EXCEPTION RAISED " &
94
                                  "FOR " & STR & "'VAL (-1)" );
95
               END;
96
          END P;
97
 
98
          PROCEDURE PCHAR IS NEW P (CHAR, "CHAR", 1);
99
          PROCEDURE PNCHAR IS NEW P (NEWCHAR, "NEWCHAR", 1);
100
          PROCEDURE PCH IS NEW P (CHARACTER, "CHARACTER", 127);
101
     BEGIN
102
          PCHAR;
103
          PNCHAR;
104
          PCH;
105
     END;
106
 
107
     RESULT;
108
END C35507N;

powered by: WebSVN 2.1.0

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