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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CE3904A.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 LAST NONBLANK CHARACTER IN A FILE MAY BE READ BY
27
--     'GET' IN ENUMERATION_IO WITHOUT RAISING END_ERROR, AND THAT AFTER
28
--     THE LAST CHARACTER OF THE FILE HAS BEEN READ, ANY ATTEMPT TO READ
29
--     FURTHER CHARACTERS WILL RAISE END_ERROR.
30
 
31
-- HISTORY:
32
--     JET 08/19/88  CREATED ORIGINAL TEST.
33
 
34
WITH REPORT, TEXT_IO;  USE REPORT, TEXT_IO;
35
PROCEDURE CE3904A IS
36
 
37
     TYPE ENUM IS (THE, QUICK, BROWN, X);
38
     E : ENUM;
39
 
40
     PACKAGE EIO IS NEW ENUMERATION_IO(ENUM);
41
     USE EIO;
42
 
43
     F : FILE_TYPE;
44
 
45
     FILE_OK : BOOLEAN := FALSE;
46
 
47
BEGIN
48
     TEST ("CE3904A", "CHECK THAT THE LAST NONBLANK CHARACTER IN A " &
49
                      "FILE MAY BE READ BY 'GET' IN ENUMERATION_IO " &
50
                      "WITHOUT RAISING END_ERROR, AND THAT AFTER THE " &
51
                      "LAST CHARACTER OF THE FILE HAS BEEN READ, ANY " &
52
                      "ATTEMPT TO READ FURTHER CHARACTERS WILL RAISE " &
53
                      "END_ERROR");
54
 
55
     BEGIN
56
          CREATE(F, OUT_FILE, LEGAL_FILE_NAME);
57
          FILE_OK := TRUE;
58
     EXCEPTION
59
          WHEN OTHERS =>
60
               NOT_APPLICABLE("DATA FILE COULD NOT BE OPENED FOR " &
61
                              "WRITING");
62
     END;
63
 
64
     IF FILE_OK THEN
65
          BEGIN
66
               PUT(F, THE); NEW_LINE(F);
67
               PUT(F, QUICK); NEW_LINE(F);
68
               PUT(F, BROWN); NEW_LINE(F);
69
               PUT(F, X); NEW_LINE(F);
70
               CLOSE(F);
71
          EXCEPTION
72
               WHEN OTHERS =>
73
                    NOT_APPLICABLE("DATA FILE COULD NOT BE WRITTEN");
74
                    FILE_OK := FALSE;
75
          END;
76
     END IF;
77
 
78
     IF FILE_OK THEN
79
          BEGIN
80
               OPEN(F, IN_FILE, LEGAL_FILE_NAME);
81
               FOR I IN 0..3 LOOP
82
                    GET(F, E);
83
                    IF E /= ENUM'VAL(I) THEN
84
                         FAILED("INCORRECT VALUE READ -" &
85
                                INTEGER'IMAGE(I));
86
                    END IF;
87
               END LOOP;
88
          EXCEPTION
89
               WHEN OTHERS =>
90
                    FAILED("UNEXPECTED EXCEPTION RAISED BEFORE END " &
91
                           "OF FILE");
92
                    FILE_OK := FALSE;
93
          END;
94
     END IF;
95
 
96
     IF FILE_OK THEN
97
          BEGIN
98
               GET(F, E);
99
               FAILED("NO EXCEPTION RAISED AFTER END OF FILE");
100
          EXCEPTION
101
               WHEN END_ERROR =>
102
                    NULL;
103
               WHEN OTHERS =>
104
                    FAILED("INCORRECT EXCEPTION RAISED AFTER END OF " &
105
                           "FILE");
106
          END;
107
 
108
          BEGIN
109
               DELETE(F);
110
          EXCEPTION
111
               WHEN OTHERS =>
112
                    COMMENT("DATA FILE COULD NOT BE DELETED");
113
          END;
114
     END IF;
115
 
116
     RESULT;
117
END CE3904A;

powered by: WebSVN 2.1.0

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