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

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

Line No. Rev Author Line
1 149 jeremybenn
-- CE2405B.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 READ RAISES END_ERROR WHEN THE CURRENT READ POSITION
27
--     IS GREATER THAN THE END POSITION.  ALSO CHECK THAT END_OF_FILE
28
--     CORRECTLY DETECTS THE END OF A DIRECT FILE.
29
 
30
-- APPLICABILITY CRITERIA:
31
--     THIS TEST IS APPLICABLE ONLY TO IMPLEMENTATIONS WHICH SUPPORT
32
--     CREATION WITH INOUT_FILE MODE AND OPENING OF IN_FILE MODE.
33
 
34
-- HISTORY:
35
--     SPS 09/28/82
36
--     JBG 02/22/84  CHANGE TO .ADA TEST
37
--     EG  05/16/85
38
--     GMT 08/03/87  ADDED CODE TO CHECK THAT END_OF_FILE WORKS, AND
39
--                   ADDED CODE TO PREVENT SOME EXCEPTION PROPAGATION.
40
 
41
WITH REPORT; USE REPORT;
42
WITH DIRECT_IO;
43
 
44
PROCEDURE CE2405B IS
45
BEGIN
46
     TEST ("CE2405B", "CHECK THAT END_ERROR IS RAISED BY READ AT THE " &
47
                      "END OF A FILE AND THAT END_OF_FILE CORRECTLY " &
48
                      "DETECTS THE END OF A DIRECT_IO FILE");
49
     DECLARE
50
          PACKAGE DIR IS NEW DIRECT_IO (CHARACTER);
51
          USE DIR;
52
          FT         : FILE_TYPE;
53
          CH         : CHARACTER;
54
          INCOMPLETE : EXCEPTION;
55
     BEGIN
56
 
57
          -- CREATE AND INITIALIZE FILE
58
 
59
          BEGIN
60
               CREATE (FT, INOUT_FILE, LEGAL_FILE_NAME);
61
          EXCEPTION
62
               WHEN USE_ERROR | NAME_ERROR =>
63
                    NOT_APPLICABLE ("USE_ERROR | NAME_ERROR WAS " &
64
                                    "RAISED ON CREATE - 1");
65
                    RAISE INCOMPLETE;
66
               WHEN OTHERS =>
67
                    FAILED ("WRONG EXCEPTION RAISED ON CREATE - 2");
68
                    RAISE INCOMPLETE;
69
          END;
70
 
71
          BEGIN
72
 
73
               WRITE (FT, 'C');
74
               WRITE (FT, 'X');
75
 
76
               -- BEGIN TEST
77
 
78
               IF NOT END_OF_FILE (FT) THEN
79
                    FAILED ("END_OF_FILE RETURNED INCORRECT " &
80
                            "BOOLEAN VALUE - 3");
81
               END IF;
82
 
83
               BEGIN
84
                    READ (FT, CH);
85
                    FAILED ("END_ERROR NOT RAISED ON READ - 4");
86
               EXCEPTION
87
                    WHEN END_ERROR =>
88
                         NULL;
89
                    WHEN OTHERS =>
90
                         FAILED ("WRONG EXCEPTION RAISED ON READ - 5");
91
               END;
92
 
93
               WRITE (FT,'E');
94
 
95
               BEGIN
96
                    READ (FT, CH);
97
                    FAILED ("END_ERROR NOT RAISED ON READ - 6");
98
               EXCEPTION
99
                    WHEN END_ERROR =>
100
                         NULL;
101
                    WHEN OTHERS =>
102
                         FAILED ("WRONG EXCEPTION RAISED ON READ - 7");
103
               END;
104
 
105
          END;
106
 
107
          CLOSE (FT);
108
 
109
          BEGIN
110
               OPEN (FT, IN_FILE, LEGAL_FILE_NAME);
111
          EXCEPTION
112
               WHEN USE_ERROR =>
113
                    NOT_APPLICABLE ("USE_ERROR RAISED ON OPEN - 8");
114
                    RAISE INCOMPLETE;
115
               WHEN OTHERS =>
116
                    FAILED ("WRONG EXCEPTION RAISED ON OPEN - 9");
117
                    RAISE INCOMPLETE;
118
          END;
119
 
120
          DECLARE
121
               COUNT_NBR_OF_READS : NATURAL := 0;
122
               EXPECTED_COUNT     : CONSTANT := 3;
123
          BEGIN
124
               LOOP
125
                    IF END_OF_FILE (FT) THEN
126
                         EXIT;
127
                    ELSE
128
                         READ (FT, CH);
129
                         COUNT_NBR_OF_READS := COUNT_NBR_OF_READS + 1;
130
                    END IF;
131
               END LOOP;
132
 
133
               IF COUNT_NBR_OF_READS /= EXPECTED_COUNT THEN
134
                      FAILED ("THE BAD VALUE FOR COUNT_NBR_OF_READS " &
135
                              "IS " &
136
                               NATURAL'IMAGE (COUNT_NBR_OF_READS) );
137
               END IF;
138
 
139
          END;
140
 
141
          BEGIN
142
               DELETE (FT);
143
          EXCEPTION
144
               WHEN USE_ERROR =>
145
                    NULL;
146
          END;
147
 
148
     EXCEPTION
149
 
150
          WHEN INCOMPLETE =>
151
               NULL;
152
 
153
     END;
154
 
155
     RESULT;
156
 
157
END CE2405B;

powered by: WebSVN 2.1.0

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