home *** CD-ROM | disk | FTP | other *** search
- --
- -- Copyright (C) 1996 Ada Resource Association (ARA), Columbus, Ohio.
- -- Author: Gilles Demailly
- --
- --
- -- Permission to use, copy, modify, and distribute this software and its
- -- documentation for any purpose and without fee is hereby granted,
- -- provided that the above copyright and authorship notice appear in all
- -- copies and that both that copyright notice and this permission notice
- -- appear in supporting documentation.
- --
- -- The ARA makes no representations about the suitability of this software
- -- for any purpose. It is provided "as is" without express
- -- or implied warranty.
- --
-
- --
- -- Procedure Port is a test procedure for package Basic_Definitions
- -- it checks the results of the bit manipulations functions
- -- for Unsigned_8 and Unsigned_64 types
- --
-
- with Ada.Text_Io;
-
- with Basic_Definitions;
- use Basic_Definitions;
-
- procedure Port is
-
- OK : Boolean := True;
-
- A1 : Unsigned_8 := 1;
- A2 : Unsigned_8 := 2;
- A3 : Unsigned_8 := 3;
- A4 : Unsigned_8 := 4;
-
- B1 : Unsigned_64 := 1;
- B2 : Unsigned_64 := 2;
- B3 : Unsigned_64 := 3;
- B4 : Unsigned_64 := 4;
-
- begin
-
- Ada.Text_Io.Put_Line (" Basic Portability Tests in progress");
-
- A1 := Shift_Left (A1, 1);
- A2 := Shift_Left (A2, 2);
- A3 := Shift_Left (A3, 1);
- A4 := Shift_Left (A4, 1);
- if A1 /= 2 or A2 /= 8 or A3 /= 6 or A4 /= 8 then
- OK := False;
- Ada.Text_Io.Put_Line
- ("Shift_Left function non portable with Unsigned_8");
- end if;
-
- A1 := 1;
- A2 := 2;
- A3 := 3;
- A4 := 4;
-
- A1 := Shift_Right (A1, 1);
- A2 := Shift_Right (A2, 2);
- A3 := Shift_Right (A3, 1);
- A4 := Shift_Right (A4, 1);
- if A1 /= 0 or A2 /= 0 or A3 /= 1 or A4 /= 2 then
- OK := False;
- Ada.Text_Io.Put_Line
- ("Shift_Right function non portable with Unsigned_8");
- end if;
-
- B1 := Shift_Left (B1, 1);
- B2 := Shift_Left (B2, 2);
- B3 := Shift_Left (B3, 1);
- B4 := Shift_Left (B4, 1);
- if B1 /= 2 or B2 /= 8 or B3 /= 6 or B4 /= 8 then
- OK := False;
- Ada.Text_Io.Put_Line
- ("Shift_Left function non portable with Unsigned_64");
- end if;
-
- B1 := 1;
- B2 := 2;
- B3 := 3;
- B4 := 4;
-
- B1 := Shift_Right (B1, 1);
- B2 := Shift_Right (B2, 2);
- B3 := Shift_Right (B3, 1);
- B4 := Shift_Right (B4, 1);
- if B1 /= 0 or B2 /= 0 or B3 /= 1 or B4 /= 2 then
- OK := False;
- Ada.Text_Io.Put_Line
- ("Shift_Right function non portable with Unsigned_64");
- end if;
-
-
- if OK then
- Ada.Text_Io.Put_Line (" ... Tests completed");
- end if;
-
- end Port;
-