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/] [c45411d.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C45411D.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 UNARY "+" AND "-" YIELD CORRECT RESULTS FOR
27
--     OPERANDS OF DERIVED INTEGER TYPES.
28
 
29
-- HISTORY:
30
--     JET 07/11/88  CREATED ORIGINAL TEST.
31
--     PWN 10/27/95  REMOVED OUT OF RANGE STATIC VALUE CHECKS.
32
 
33
WITH REPORT; USE REPORT;
34
 
35
PROCEDURE C45411D IS
36
 
37
     TYPE INT IS RANGE -100..100;
38
 
39
     TYPE DT1 IS NEW INTEGER;
40
     TYPE DT2 IS NEW INT;
41
 
42
     D1 : DT1 := 1;
43
     D2 : DT2 := 1;
44
 
45
     FUNCTION IDENT (A : DT1) RETURN DT1 IS
46
     BEGIN
47
          RETURN A * DT1(IDENT_INT(1));
48
     END IDENT;
49
 
50
     FUNCTION IDENT (A : DT2) RETURN DT2 IS
51
     BEGIN
52
          RETURN A * DT2(IDENT_INT(1));
53
     END IDENT;
54
 
55
BEGIN
56
     TEST ("C45411D", "CHECK THAT UNARY ""+"" AND ""-"" YIELD " &
57
                      "CORRECT RESULTS FOR OPERANDS OF DERIVED " &
58
                      "INTEGER TYPES");
59
 
60
     FOR I IN DT1'(1-2)..DT1'(1) LOOP
61
          IF "-"(RIGHT => D1) /= IDENT(I) THEN
62
               FAILED ("INCORRECT RESULT FOR ""-"" DT1 -" &
63
                       DT1'IMAGE(I+2));
64
          END IF;
65
 
66
          IF +D1 /= IDENT(D1) THEN
67
               FAILED ("INCORRECT RESULT FOR ""+"" DT1 -" &
68
                       DT1'IMAGE(I+2));
69
          END IF;
70
          D1 := D1 - 1;
71
     END LOOP;
72
 
73
     IF DT1'LAST + DT1'FIRST = 0 THEN
74
          IF IDENT(-DT1'LAST) /= DT1'FIRST THEN
75
               FAILED ("-DT1'LAST IS NOT EQUAL TO DT1'FIRST");
76
          END IF;
77
     ELSE
78
          IF IDENT(-DT1'LAST) /= DT1'FIRST+1 THEN
79
               FAILED ("-DT1'LAST IS NOT EQUAL TO DT1'FIRST+1");
80
          END IF;
81
     END IF;
82
 
83
     FOR I IN DT2'(1-2)..DT2'(1) LOOP
84
          IF -D2 /= IDENT(I) THEN
85
               FAILED ("INCORRECT RESULT FOR ""-"" DT2 -" &
86
                       DT2'IMAGE(I+2));
87
          END IF;
88
 
89
          IF "+"(RIGHT => D2) /= IDENT(D2) THEN
90
               FAILED ("INCORRECT RESULT FOR ""+"" DT2 -" &
91
                       DT2'IMAGE(I+2));
92
          END IF;
93
          D2 := D2 - 1;
94
     END LOOP;
95
 
96
     RESULT;
97
 
98
END C45411D;

powered by: WebSVN 2.1.0

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