File: test_unit.adb

package info (click to toggle)
asis 2005-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 6,424 kB
  • ctags: 27
  • sloc: ada: 73,883; makefile: 201
file content (52 lines) | stat: -rw-r--r-- 918 bytes parent folder | download | duplicates (10)
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
--  This is the test unit to try out the ASIS applications built
--  in the framework of the ASIS tutorial.

with Ada.Text_IO; use Ada.Text_IO;

package body Test_Unit is

   procedure Swap (A, B : in out T) is
     C : T;
   begin
      if A = B then
         return;
      else
         C := A;
         A := B;
         B := C;
      end if;
   end Swap;

   procedure Swap_Integer is new Swap (Integer);

   procedure Use_Swap_Integer is
      X, Y : Integer;
      package Int_IO is new Integer_IO (Integer);
      use Int_IO;
   begin
      X :=  7;
      Y := 13;

      Put ("X = ");
      Put (X);
      New_Line;

      Put ("Y = ");
      Put (Y);
      New_Line;

      Swap_Integer (X, Y);

      New_Line;
      Put ("X = ");
      Put (X);
      New_Line;

      Put ("Y = ");
      Put (Y);
      New_Line;

   end Use_Swap_Integer;


end Test_Unit;