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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CE3804G.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 FLOAT_IO GET WHEN SUPPLIED WITH A WIDTH PARAMETER
27
--     GREATER THAN ZERO READS ONLY THAT MANY CHARACTERS.  ALSO CHECK
28
--     THAT INPUT TERMINATES WHEN A LINE TERMINATOR IS ENCOUNTERED AND
29
--     THAT DATA_ERROR IS RAISED WHEN THE DATA IS INVALID.
30
 
31
-- APPLICABILITY CRITERIA:
32
--     THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH
33
--     SUPPORT TEXT FILES.
34
 
35
-- HISTORY:
36
--     SPS 09/08/82
37
--     SPS 12/14/82
38
--     VKG 01/13/83
39
--     SPS 02/08/83
40
--     JBG 02/22/84  CHANGED TO .ADA TEST
41
--     RJW 11/04/86  REVISED TEST TO OUTPUT A NON_APPLICABLE
42
--                   RESULT WHEN FILES ARE NOT SUPPORTED.
43
--     DWC 09/14/87  SPLIT CASE FOR FIXED_IO INTO CE3804H.ADA AND
44
--                   CORRECTED EXCEPTION HANDLING.
45
--     LDC 06/01/88  CHANGED TEST VALUE FROM "3.525" TO "3.625".
46
 
47
WITH REPORT;
48
USE REPORT;
49
WITH TEXT_IO;
50
USE TEXT_IO;
51
 
52
PROCEDURE CE3804G IS
53
     INCOMPLETE : EXCEPTION;
54
 
55
BEGIN
56
 
57
     TEST ("CE3804G", "CHECK THAT FLOAT_IO GET WHEN SUPPLIED WITH " &
58
                      "A WIDTH PARAMETER GREATER THAN ZERO READS " &
59
                      "ONLY THAT MANY CHARACTERS.  ALSO CHECK THAT " &
60
                      "INPUT TERMINATES WHEN A LINE TERMINATOR IS " &
61
                      "ENCOUNTERED AND THAT DATA_ERROR IS RAISED " &
62
                      "WHEN THE DATA IS INVALID.");
63
 
64
     DECLARE
65
          FT : FILE_TYPE;
66
     BEGIN
67
 
68
          BEGIN
69
               CREATE (FT, OUT_FILE, LEGAL_FILE_NAME);
70
          EXCEPTION
71
               WHEN USE_ERROR =>
72
                    NOT_APPLICABLE ("USE_ERROR RAISED; TEXT CREATE " &
73
                                    "WITH OUT_FILE MODE");
74
                    RAISE INCOMPLETE;
75
               WHEN NAME_ERROR =>
76
                    NOT_APPLICABLE ("NAME_ERROR RAISED; TEXT CREATE " &
77
                                    "WITH OUT_FILE MODE");
78
                    RAISE INCOMPLETE;
79
          END;
80
 
81
          PUT(FT, "3.259.5 8.52");
82
          NEW_LINE (FT);
83
          PUT (FT, "  ");
84
          NEW_LINE (FT);
85
          PUT (FT, ASCII.HT & "9.0");
86
          NEW_LINE (FT);
87
          PUT (FT, "-3.625");
88
          NEW_LINE (FT);
89
          CLOSE (FT);
90
 
91
-- BEGIN TEST
92
 
93
          DECLARE
94
               TYPE FL IS DIGITS 4;
95
               PACKAGE FL_IO IS NEW FLOAT_IO (FL);
96
               USE FL_IO;
97
               X : FL;
98
          BEGIN
99
 
100
               BEGIN
101
                    OPEN (FT, IN_FILE, LEGAL_FILE_NAME);
102
               EXCEPTION
103
                    WHEN USE_ERROR =>
104
                         NOT_APPLICABLE ("USE_ERROR RAISED; TEXT" &
105
                                         "OPEN WITH IN_FILE MODE");
106
                         RAISE INCOMPLETE;
107
               END;
108
 
109
               GET (FT, X, 4);
110
               IF X /= 3.25 THEN
111
                    FAILED ("WIDTH CHARACTERS NOT READ - FLOAT");
112
               ELSE
113
                    GET (FT, X, 3);
114
                    IF X /= 9.5 THEN
115
                         FAILED ("WIDTH CHARACTERS NOT READ - " &
116
                                 "FLOAT 2");
117
                    ELSE
118
                         GET (FT, X, 4);
119
                         IF X /= 8.5 THEN
120
                              FAILED ("DIDN'T COUNT LEADING BLANKS " &
121
                                      "- FLOAT");
122
                         ELSE
123
                              SKIP_LINE(FT);
124
                              BEGIN
125
                                   GET (FT, X, 2);
126
                                   FAILED ("DATA_ERROR NOT RAISED - " &
127
                                           "FLOAT");
128
                              EXCEPTION
129
                                   WHEN DATA_ERROR =>
130
                                        NULL;
131
                                   WHEN OTHERS =>
132
                                        FAILED ("WRONG EXCEPTION RAISED"
133
                                             & " - FLOAT");
134
                              END;
135
                              SKIP_LINE(FT);
136
                              GET (FT, X, 4);
137
                              IF X /= 9.0 THEN
138
                                   FAILED ("GET WITH WIDTH " &
139
                                           "INCORRECT - 3");
140
                              END IF;
141
 
142
                              SKIP_LINE (FT);
143
                              GET (FT, X, 7);
144
                              IF X /= -3.625 THEN
145
                                   FAILED ("WIDTH CHARACTERS NOT " &
146
                                           "READ - FLOAT 3");
147
                              END IF;
148
                         END IF;
149
                    END IF;
150
               END IF;
151
 
152
               BEGIN
153
                   DELETE (FT);
154
               EXCEPTION
155
                   WHEN USE_ERROR =>
156
                        NULL;
157
               END;
158
          END;
159
 
160
     EXCEPTION
161
          WHEN INCOMPLETE =>
162
               NULL;
163
     END;
164
 
165
     RESULT;
166
 
167
END CE3804G;

powered by: WebSVN 2.1.0

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