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/] [c9/] [c96005a.ada] - Blame information for rev 399

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

Line No. Rev Author Line
1 294 jeremybenn
-- C96005A.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
-- CHECK THE CORRECTNESS OF THE ADDITION AND SUBTRACTION FUNCTIONS IN
26
-- THE PREDEFINED PACKAGE CALENDAR, AND APPROPRIATE EXCEPTION HANDLING.
27
-- SPECIFICALLY,
28
--   (A) CHECK THAT ADDITION AND SUBTRACTION OPERATORS WORK CORRECTLY ON
29
--       VALUES OF TYPE TIME.
30
 
31
-- CPP 8/16/84
32
 
33
WITH CALENDAR;  USE CALENDAR;
34
WITH REPORT;  USE REPORT;
35
-- WITH TEXT_IO;  USE TEXT_IO;
36
PROCEDURE C96005A IS
37
 
38
     -- PACKAGE DURATION_IO IS NEW FIXED_IO (DURATION);
39
     -- USE DURATION_IO;
40
 
41
BEGIN
42
     TEST ("C96005A", "CHECK THAT THE ADDITION AND SUBTRACTION " &
43
           "FUNCTIONS FOR VALUES OF TYPE TIME WORK CORRECTLY");
44
 
45
     -----------------------------------------------
46
 
47
     BEGIN     -- (A)
48
 
49
          -- ADDITION TESTS FOLLOW.
50
          DECLARE
51
               NOW, NEW_TIME : TIME;
52
               INCREMENT : DURATION := 1.0;
53
          BEGIN
54
               NOW := TIME_OF (1984, 8, 13, 0.0);
55
               NEW_TIME := NOW + INCREMENT;
56
               IF NEW_TIME /= TIME_OF (1984, 8, 13, 1.0) THEN
57
                    FAILED ("SUM OF TIMES IS INCORRECT - (A)1");
58
               END IF;
59
          END;
60
 
61
 
62
          DECLARE
63
               NOW, NEW_TIME : TIME;
64
               INCREMENT : DURATION := 1.0;
65
          BEGIN
66
               NOW := TIME_OF (1984, 8, 13, 0.0);
67
               NEW_TIME :=  INCREMENT + NOW;
68
               IF NEW_TIME /= TIME_OF (1984, 8, 13, 1.0) THEN
69
                    FAILED ("SUM OF TIMES IS INCORRECT - (A)2");
70
               END IF;
71
          END;
72
 
73
 
74
          DECLARE
75
               NOW, NEW_TIME : TIME;
76
               INCREMENT : DURATION := 1.0;
77
          BEGIN
78
               NOW := TIME_OF (1984, 8, 13, 0.0);
79
               NEW_TIME := "+"(INCREMENT, NOW);
80
               IF NEW_TIME /= TIME_OF (1984, 8, 13, 1.0) THEN
81
                    FAILED ("SUM OF TIMES IS INCORRECT - (A)3");
82
               END IF;
83
          END;
84
 
85
 
86
          DECLARE
87
               NOW, NEW_TIME : TIME;
88
               INCREMENT : DURATION := 1.0;
89
          BEGIN
90
               NOW := TIME_OF (1984, 8, 13, 0.0);
91
               NEW_TIME := "+"(LEFT => NOW,
92
                               RIGHT => INCREMENT);
93
               IF NEW_TIME /= TIME_OF (1984, 8, 13, 1.0) THEN
94
                    FAILED ("SUM OF TIMES IS INCORRECT - (A)4");
95
               END IF;
96
          END;
97
 
98
 
99
          -- SUBTRACTION TESTS FOLLOW.
100
          DECLARE
101
               NOW, ONCE : TIME;
102
               DIFFERENCE : DURATION;
103
          BEGIN
104
               NOW := TIME_OF (1984, 8, 13, 45_000.0);
105
               ONCE := TIME_OF (1984, 8, 12, 45_000.0);
106
               DIFFERENCE := NOW - ONCE;
107
               IF DIFFERENCE /= 86_400.0 THEN
108
                    FAILED ("DIFFERENCE OF TIMES IS INCORRECT - (A)1");
109
                    -- COMMENT ("DIFFERENCE YIELDS: ");
110
                    -- PUT (DIFFERENCE);
111
               END IF;
112
          END;
113
 
114
 
115
          DECLARE
116
          -- TIMES IN DIFFERENT MONTHS.
117
               NOW, ONCE : TIME;
118
               DIFFERENCE : DURATION;
119
          BEGIN
120
               NOW := TIME_OF (1984, 8, IDENT_INT(1), 60.0);
121
               ONCE := TIME_OF (1984, 7, 31, 86_399.0);
122
               DIFFERENCE := "-"(NOW, ONCE);
123
               IF DIFFERENCE /= 61.0 THEN
124
                    FAILED ("DIFFERENCE OF TIMES IS INCORRECT - (A)2");
125
                    -- COMMENT ("DIFFERENCE YIELDS: ");
126
                    -- PUT (DIFFERENCE);
127
               END IF;
128
          END;
129
 
130
 
131
          DECLARE
132
          -- TIMES IN DIFFERENT YEARS.
133
               NOW, AFTER : TIME;
134
               DIFFERENCE : DURATION;
135
          BEGIN
136
               NOW := TIME_OF (IDENT_INT(1999), 12, 31, 86_399.0);
137
               AFTER := TIME_OF (2000, 1, 1, 1.0);
138
               DIFFERENCE := "-"(LEFT => AFTER,
139
                                 RIGHT => NOW);
140
               IF DIFFERENCE /= 2.0 THEN
141
                    FAILED ("DIFFERENCE OF TIMES IS INCORRECT - (A)3");
142
                    -- COMMENT ("DIFFERENCE YIELDS: ");
143
                    -- PUT (DIFFERENCE);
144
               END IF;
145
          END;
146
 
147
 
148
          DECLARE
149
          -- TIMES IN A LEAP YEAR.
150
               NOW, LEAP : TIME;
151
               DIFFERENCE : DURATION;
152
          BEGIN
153
               NOW := TIME_OF (1984, 3, 1);
154
               LEAP := TIME_OF (1984, 2, 29, 86_399.0);
155
               DIFFERENCE := NOW - LEAP;
156
               IF DIFFERENCE /= 1.0 THEN
157
                    FAILED ("DIFFERENCE OF TIMES IS INCORRECT - (A)4");
158
                    -- COMMENT ("DIFFERENCE YIELDS: ");
159
                    -- PUT (DIFFERENCE);
160
               END IF;
161
          END;
162
 
163
 
164
          DECLARE
165
          -- TIMES IN A NON-LEAP YEAR.
166
               NOW, NON_LEAP : TIME;
167
               DIFFERENCE : DURATION;
168
          BEGIN
169
               NOW := TIME_OF (1983, 3, 1);
170
               NON_LEAP := TIME_OF (1983, 2, 28, 86_399.0);
171
               DIFFERENCE := NOW - NON_LEAP;
172
               IF DIFFERENCE /= 1.0 THEN
173
                    FAILED ("DIFFERENCE OF TIMES IS INCORRECT - (A)5");
174
                    -- COMMENT ("DIFFERENCE YIELDS: ");
175
                    -- PUT (DIFFERENCE);
176
               END IF;
177
          END;
178
 
179
 
180
          -- SUBTRACTION TESTS FOLLOW: TIME - DURATION.
181
          DECLARE
182
               NOW, NEW_TIME : TIME;
183
               INCREMENT : DURATION := 1.0;
184
          BEGIN
185
               NOW := TIME_OF (1984, 8, 13, 0.0);
186
               NEW_TIME := NOW - INCREMENT;
187
               IF NEW_TIME /= TIME_OF (1984, 8, 12, 86_399.0) THEN
188
                    FAILED ("DIFFERENCE OF TIME AND DURATION IS " &
189
                            "INCORRECT - (A)6");
190
               END IF;
191
          END;
192
 
193
 
194
          DECLARE
195
               NOW, NEW_TIME : TIME;
196
               INCREMENT : DURATION := 1.0;
197
          BEGIN
198
               NOW := TIME_OF (1984, 8, 1, 0.0);
199
               NEW_TIME := NOW - INCREMENT;
200
               IF NEW_TIME /= TIME_OF (1984, 7, 31, 86_399.0) THEN
201
                    FAILED ("DIFFERENCE OF TIME AND DURATION IS " &
202
                            "INCORRECT - (A)7");
203
               END IF;
204
          END;
205
 
206
 
207
          DECLARE
208
               NOW, NEW_TIME : TIME;
209
               INCREMENT : DURATION := 1.0;
210
          BEGIN
211
               NOW := TIME_OF (1984, 8, 1, 0.0);
212
               NEW_TIME := "-"(LEFT => NOW,
213
                               RIGHT => INCREMENT);
214
               IF NEW_TIME /= TIME_OF (1984, 7, 31, 86_399.0) THEN
215
                    FAILED ("DIFFERENCE OF TIME AND DURATION IS " &
216
                            "INCORRECT - (A)8");
217
               END IF;
218
          END;
219
 
220
 
221
          DECLARE
222
               NOW, NEW_TIME : TIME;
223
               INCREMENT : DURATION := 1.0;
224
          BEGIN
225
               NOW := TIME_OF (1984, 8, 1, 0.0);
226
               NEW_TIME := "-"(NOW, INCREMENT);
227
               IF NEW_TIME /= TIME_OF (1984, 7, 31, 86_399.0) THEN
228
                    FAILED ("DIFFERENCE OF TIME AND DURATION IS " &
229
                            "INCORRECT - (A)7");
230
               END IF;
231
          END;
232
 
233
 
234
     END; -- (A)
235
 
236
     -----------------------------------------------
237
 
238
     RESULT;
239
END C96005A;

powered by: WebSVN 2.1.0

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