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/] [c3/] [c35507l.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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