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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C96008A.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
-- MISCELLANEOUS CHECKS ON THE PRE-DEFINED FUNCTIONS IN THE PACKAGE
26
-- CALENDAR.  SUBTESTS ARE:
27
--   (A) TIME_OF() AND SPLIT() ARE INVERSE FUNCTIONS.
28
--   (B) FORMAL PARAMETERS OF TIME_OF() AND SPLIT() ARE NAMED CORRECTLY.
29
--   (C) TIME_OF() GIVES THE PARAMETER SECONDS A DEFAULT VALUE OF 0.0.
30
--   (D) THE FUNCTIONS YEAR(), MONTH(), DAY(), AND SECONDS() RETURN
31
--       CORRECT VALUES USING NAMED NOTATION.
32
--   (E) A VALUE RETURNED FROM CLOCK() CAN BE PROCESSED BY SPLIT().
33
--   (F) DURATION'SMALL MEETS REQUIRED LIMIT.
34
 
35
-- CPP 8/16/84
36
 
37
WITH SYSTEM;
38
WITH CALENDAR;  USE CALENDAR;
39
WITH REPORT;  USE REPORT;
40
PROCEDURE C96008A IS
41
 
42
BEGIN
43
     TEST ("C96008A", "CHECK MISCELLANEOUS FUNCTIONS IN THE " &
44
           "PACKAGE CALENDAR");
45
 
46
     ---------------------------------------------
47
 
48
     DECLARE   -- (A)
49
          NOW : TIME;
50
          YR : YEAR_NUMBER;
51
          MO : MONTH_NUMBER;
52
          DY : DAY_NUMBER;
53
          SEC : DAY_DURATION;
54
     BEGIN     -- (A)
55
          BEGIN
56
               NOW := TIME_OF (1984, 8, 13, DURATION(1.0/3.0));
57
               SPLIT (NOW, YR, MO, DY, SEC);
58
               IF NOW /= TIME_OF (YR, MO, DY, SEC) THEN
59
                    COMMENT ("TIME_OF AND SPLIT ARE NOT INVERSES " &
60
                             "WHEN SECONDS IS A NON-MODEL NUMBER " &
61
                             "- (A)");
62
               END IF;
63
          EXCEPTION
64
               WHEN OTHERS =>
65
                    FAILED ("TIME_OF(SPLIT) RAISED EXCEPTION - (A)");
66
          END;
67
 
68
 
69
          BEGIN
70
               -- RESET VALUES.
71
               YR := 1984;
72
               MO := 8;
73
               DY := 13;
74
               SEC := 1.0;
75
 
76
               SPLIT (TIME_OF (YR, MO, DY, SEC), YR, MO, DY, SEC);
77
 
78
               IF YR /= 1984 THEN
79
                    FAILED ("SPLIT(TIME_OF) CHANGED VALUE OF YR - (A)");
80
               END IF;
81
 
82
               IF MO /= 8 THEN
83
                    FAILED ("SPLIT(TIME_OF) CHANGED VALUE OF MO - (A)");
84
               END IF;
85
 
86
               IF DY /= 13 THEN
87
                    FAILED ("SPLIT(TIME_OF) CHANGED VALUE OF DY - (A)");
88
               END IF;
89
 
90
               IF SEC /= 1.0 THEN
91
                    FAILED ("SPLIT(TIME_OF) CHANGED VALUE OF " &
92
                            "SEC - (A)");
93
               END IF;
94
          EXCEPTION
95
               WHEN OTHERS =>
96
                    FAILED ("SPLIT(TIME_OF) PROCESSING RAISED " &
97
                            "EXCEPTION - (A)");
98
          END;
99
     END; -- (A)
100
 
101
     ---------------------------------------------
102
 
103
     BEGIN     -- (B)
104
          DECLARE
105
               NOW : TIME;
106
          BEGIN
107
               NOW := TIME_OF (YEAR => 1984,
108
                               MONTH => 8,
109
                               DAY => 13,
110
                               SECONDS => 60.0);
111
          EXCEPTION
112
               WHEN OTHERS =>
113
                    FAILED ("NAMED ASSOCIATION ON TIME_OF() RAISED " &
114
                            "EXCEPTION - (B)");
115
          END;
116
 
117
 
118
          DECLARE
119
               NOW : TIME := CLOCK;
120
               YR : YEAR_NUMBER := 1984;
121
               MO : MONTH_NUMBER := 8;
122
               DY : DAY_NUMBER := 13;
123
               SEC : DAY_DURATION := 0.0;
124
          BEGIN
125
               SPLIT (DATE => NOW,
126
                      YEAR => YR,
127
                      MONTH => MO,
128
                      DAY => DY,
129
                      SECONDS => SEC);
130
          EXCEPTION
131
               WHEN OTHERS =>
132
                    FAILED ("NAMED ASSOCIATION ON SPLIT() RAISED " &
133
                            "EXCEPTION - (B)2");
134
          END;
135
     END; -- (B)
136
 
137
     ---------------------------------------------
138
 
139
     DECLARE   -- (C)
140
          NOW : TIME;
141
     BEGIN     -- (C)
142
          NOW := TIME_OF (1984, 8, 13);
143
          IF SECONDS (NOW) /= 0.0 THEN
144
               FAILED ("TIME_OF() DID NOT ZERO SECONDS - (C)");
145
          END IF;
146
     END; -- (C)
147
 
148
     ---------------------------------------------
149
 
150
     DECLARE   -- (D)
151
     -- ASSUMES TIME_OF() WORKS CORRECTLY.
152
          HOLIDAY : TIME;
153
     BEGIN     -- (D)
154
          HOLIDAY := TIME_OF (1958, 9, 9, 1.0);
155
 
156
          IF YEAR (DATE => HOLIDAY) /= 1958 THEN
157
               FAILED ("YEAR() DID NOT RETURN CORRECT VALUE - (D)");
158
          END IF;
159
 
160
          IF MONTH (DATE => HOLIDAY) /= 9 THEN
161
               FAILED ("MONTH() DID NOT RETURN CORRECT VALUE - (D)");
162
          END IF;
163
 
164
          IF DAY (DATE => HOLIDAY) /= 9 THEN
165
               FAILED ("DAY() DID NOT RETURN CORRECT VALUE - (D)");
166
          END IF;
167
 
168
          IF SECONDS (HOLIDAY) /= 1.0 THEN
169
               FAILED ("SECONDS() DID NOT RETURN CORRECT VALUE - (D)");
170
          END IF;
171
     END; -- (D)
172
 
173
     ---------------------------------------------
174
 
175
     DECLARE   -- (E)
176
          YR : YEAR_NUMBER;
177
          MO : MONTH_NUMBER;
178
          DY : DAY_NUMBER;
179
          SEC : DAY_DURATION;
180
     BEGIN     -- (E)
181
          SPLIT (CLOCK, YR, MO, DY, SEC);
182
          DELAY SYSTEM.TICK;
183
 
184
          IF TIME_OF (YR, MO, DY, SEC) > CLOCK THEN
185
               FAILED ("SPLIT() ON CLOCK INCORRECT - (E)");
186
          END IF;
187
     EXCEPTION
188
          WHEN OTHERS =>
189
               FAILED ("SPLIT() ON CLOCK RAISED EXCEPTION - (E)");
190
     END; -- (E)
191
 
192
     ---------------------------------------------
193
 
194
     BEGIN     -- (F)
195
          IF DURATION'SMALL > 0.020 THEN
196
               FAILED ("DURATION'SMALL LARGER THAN SPECIFIED - (F)");
197
          END IF;
198
     END; -- (F)
199
 
200
     ---------------------------------------------
201
 
202
     RESULT;
203
END C96008A;

powered by: WebSVN 2.1.0

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