| 1 |
-- { dg-do run } |
| 2 |
-- { dg-options "-O2" } |
| 3 |
|
| 4 |
with Ada.Calendar.Formatting; |
| 5 |
|
| 6 |
procedure Calendar_Format_Value is |
| 7 |
Limit : constant Duration |
| 8 |
:= 99 * 3600.0 + 59 * 60.0 + 59.0; |
| 9 |
begin |
| 10 |
declare |
| 11 |
Image : constant String := Ada.Calendar.Formatting .Image (Limit); |
| 12 |
Image_Error : exception; |
| 13 |
begin |
| 14 |
if Image /= "99:59:59" then |
| 15 |
raise Image_Error with "image: " & Image; |
| 16 |
end if; |
| 17 |
declare |
| 18 |
Value : constant Duration := Ada.Calendar.Formatting.Value (Image); |
| 19 |
Value_Error : exception; |
| 20 |
begin |
| 21 |
if Value /= Limit then |
| 22 |
raise Value_Error with "duration: " & Value'Image; |
| 23 |
end if; |
| 24 |
end; |
| 25 |
end; |
| 26 |
end Calendar_Format_Value; |