/
testbed.adb
112 lines (90 loc) · 2.84 KB
/
testbed.adb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
-- Copyright (C) 2016, 2017 Free Software Foundation, Inc.
-- This file is part of the Cortex GNAT RTS package.
--
-- The Cortex GNAT RTS package is free software; you can redistribute
-- it and/or modify it under the terms of the GNU General Public
-- License as published by the Free Software Foundation; either
-- version 3 of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; see the file COPYING3. If not, see
-- <http://www.gnu.org/licenses/>.
-- This program has no visible functionality; the idea is to use the
-- debugger to check that the expected effect has happened.
with Ada.Real_Time;
with Containing;
pragma Unreferenced (Containing);
-- Ada.Containers
with Dispatching;
pragma Unreferenced (Dispatching);
-- Tagged types
with Floating_Point;
pragma Unreferenced (Floating_Point);
-- Floating point
with Images;
pragma Unreferenced (Images);
-- 'Image(), 'Img
with Interfaces.C.Strings;
pragma Unreferenced (Interfaces.C.Strings);
-- Check we can build with this package in the closure.
with Interrupts;
pragma Unreferenced (Interrupts);
-- Check interrupt handling.
with Iteration;
pragma Unreferenced (Iteration);
-- Generalized iteration
with Heartbeat;
pragma Unreferenced (Heartbeat);
-- Timing
with Last_Chance_Handler;
pragma Unreferenced (Last_Chance_Handler);
-- Check we can supply our own version, replacing libgnat's weak one.
with Ada.Numerics.Elementary_Functions;
with SO;
pragma Unreferenced (SO);
-- Check suspension objects.
with Streams;
with Strings;
pragma Unreferenced (Strings);
-- Secondary stack
procedure Testbed is
function Use_Secondary_Stack (S : String) return String;
function Use_Secondary_Stack (S : String) return String is
begin
return S (S'First .. Positive'Min (10, S'Length) + S'First - 1);
end Use_Secondary_Stack;
begin
-- Check local handling of exceptions
declare
Err : exception;
begin
begin
raise Err;
end;
exception
when Err => null;
end;
-- Check secondary stack use
declare
S : constant String := Use_Secondary_Stack ("hello world")
with Unreferenced;
begin
null;
end;
declare
Result : Float := 0.0 with Volatile, Unreferenced;
begin
Result := Ada.Numerics.Elementary_Functions.Sqrt (2.0);
-- need a valid statement inside the block for 'next' to get to
-- in the debugger
delay until Ada.Real_Time.Clock;
end;
-- Check streams
Streams.Check (42);
delay until Ada.Real_Time.Time_Last;
end Testbed;