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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CE3707A.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 INTEGER_IO GET CAN READ A VALUE FROM A STRING.  CHECK
27
--     THAT IT TREATS THE END OF THE STRING AS A FILE TERMINATOR.  CHECK
28
--     THAT LAST CONTAINS THE INDEX VALUE OF THE LAST CHARACTER READ
29
--     FROM THE STRING.
30
 
31
-- HISTORY:
32
--     SPS 10/05/82
33
--     VKG 01/13/83
34
--     JLH 09/11/87  CORRECTED EXCEPTION HANDLING.
35
 
36
WITH REPORT; USE REPORT;
37
WITH TEXT_IO; USE TEXT_IO;
38
 
39
PROCEDURE CE3707A IS
40
 
41
     PACKAGE IIO IS NEW INTEGER_IO (INTEGER);
42
     USE IIO;
43
     X : INTEGER;
44
     L : POSITIVE;
45
     STR : STRING(1..6) := "123456" ;
46
 
47
BEGIN
48
 
49
     TEST ("CE3707A", "CHECK THAT INTEGER_IO GET OPERATES CORRECTLY " &
50
                      "ON STRINGS");
51
 
52
-- LEFT JUSTIFIED STRING NON NULL
53
 
54
     GET ("2362  ", X, L);
55
     IF X /= 2362 THEN
56
          FAILED ("VALUE FROM STRING INCORRECT - 1");
57
     END IF;
58
 
59
     IF L /= 4 THEN
60
          FAILED ("VALUE OF LAST INCORRECT - 1");
61
     END IF;
62
 
63
-- STRING LITERAL WITH BLANKS
64
 
65
     BEGIN
66
          GET ("  ", X, L);
67
          FAILED ("END_ERROR NOT RAISED - 2");
68
     EXCEPTION
69
          WHEN END_ERROR =>
70
               IF L /= 4 THEN
71
                    FAILED ("AFTER END ERROR VALUE OF LAST " &
72
                            "INCORRECT - 2");
73
               END IF;
74
          WHEN OTHERS =>
75
               FAILED ("WRONG EXCEPTION RAISED - 2");
76
     END;
77
 
78
-- NULL STRING
79
 
80
     BEGIN
81
          GET ("", X, L);
82
          FAILED (" END_ERROR NOT RAISED - 3");
83
     EXCEPTION
84
          WHEN END_ERROR =>
85
               IF L /= 4 THEN
86
                    FAILED ("AFTER END_ERROR VALUE OF LAST " &
87
                            "INCORRECT - 3");
88
               END IF;
89
          WHEN OTHERS =>
90
               FAILED ("SOME EXCEPTION RAISED - 3");
91
     END;
92
 
93
-- NULL SLICE
94
 
95
     BEGIN
96
          GET(STR(5..IDENT_INT(2)), X, L);
97
          FAILED ("END_ERROR NOT RAISED - 4");
98
     EXCEPTION
99
          WHEN END_ERROR =>
100
               IF L /= 4 THEN
101
                    FAILED ("AFTER END_ERROR VALUE OF LAST " &
102
                            "INCORRECT - 4");
103
               END IF;
104
          WHEN OTHERS =>
105
               FAILED ("SOME EXCEPTION RAISED - 4");
106
     END;
107
 
108
-- NON-NULL SLICE
109
 
110
     GET (STR(2..3), X, L);
111
     IF X /= 23 THEN
112
           FAILED ("INTEGER VALUE INCORRECT - 5");
113
     END IF;
114
     IF L /= 3 THEN
115
          FAILED ("LAST INCORRECT FOR SLICE - 5");
116
     END IF;
117
 
118
-- RIGHT JUSTIFIED NEGATIVE NUMBER
119
 
120
     GET("   -2345",X,L);
121
     IF X /= -2345 THEN
122
          FAILED ("INTEGER VALUE INCORRECT - 6");
123
     END IF;
124
     IF L /= 8 THEN
125
          FAILED ("LAST INCORRECT FOR NEGATIVE NUMBER - 6");
126
     END IF;
127
 
128
     RESULT;
129
 
130
END CE3707A;

powered by: WebSVN 2.1.0

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