~ubuntu-branches/ubuntu/karmic/asis/karmic

« back to all changes in this revision

Viewing changes to tutorial/using_templets/test_units/test_unit.adb

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Quinot
  • Date: 2002-03-03 19:55:58 UTC
  • Revision ID: james.westby@ubuntu.com-20020303195558-g7dp4vaq1zdkf814
Tags: upstream-3.14p
ImportĀ upstreamĀ versionĀ 3.14p

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--  This is the test unit to try out the ASIS applications built
 
2
--  in the framework of the ASIS tutorial.
 
3
 
 
4
with Ada.Text_IO; use Ada.Text_IO;
 
5
 
 
6
package body Test_Unit is
 
7
 
 
8
   procedure Swap (A, B : in out T) is
 
9
     C : T;
 
10
   begin
 
11
      if A = B then
 
12
         return;
 
13
      else
 
14
         C := A;
 
15
         A := B;
 
16
         B := C;
 
17
      end if;
 
18
   end Swap;
 
19
 
 
20
   procedure Swap_Integer is new Swap (Integer);
 
21
 
 
22
   procedure Use_Swap_Integer is
 
23
      X, Y : Integer;
 
24
      package Int_IO is new Integer_IO (Integer);
 
25
      use Int_IO;
 
26
   begin
 
27
      X :=  7;
 
28
      Y := 13;
 
29
 
 
30
      Put ("X = ");
 
31
      Put (X);
 
32
      New_Line;
 
33
 
 
34
      Put ("Y = ");
 
35
      Put (Y);
 
36
      New_Line;
 
37
 
 
38
      Swap_Integer (X, Y);
 
39
 
 
40
      New_Line;
 
41
      Put ("X = ");
 
42
      Put (X);
 
43
      New_Line;
 
44
 
 
45
      Put ("Y = ");
 
46
      Put (Y);
 
47
      New_Line;
 
48
 
 
49
   end Use_Swap_Integer;
 
50
 
 
51
 
 
52
end Test_Unit;