cxb2001.a

来自「Mac OS X 10.4.9 for x86 Source Code gcc」· A 代码 · 共 634 行 · 第 1/2 页

A
634
字号
         -- Case where the parameter Value is greater than or equal to         -- one half of the modulus.  One bits will be shifted in.                TC_Amount            := 1;         TC_Val_Unsigned_8    := 128;  -- One half of modulus.         TC_Result_Unsigned_8 := Shift_Right_Arithmetic(TC_Val_Unsigned_8,                                                        Amount => TC_Amount);         if TC_Result_Unsigned_8 /= 192 then            Report.Failed              ("Incorrect result from BE Shift_Right_Arithmetic - 4");         end if;         TC_Amount            := 1;         TC_Val_Unsigned_8    := 129;  -- Greater than one half of modulus.         TC_Result_Unsigned_8 := Shift_Right_Arithmetic(TC_Val_Unsigned_8,                                                        Amount => TC_Amount);         if TC_Result_Unsigned_8 /= 192 then            Report.Failed              ("Incorrect result from BE Shift_Right_Arithmetic - 5");         end if;         if Shift_Right_Arithmetic(TC_Val_Unsigned_8, 2) /= 224  or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 3) /= 240  or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 5) /= 252  or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 7) /= Unsigned_8'Last or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 0) /= TC_Val_Unsigned_8           then            Report.Failed              ("Incorrect result from BE Shift_Right_Arithmetic - 6");         end if;         TC_Val_Unsigned_8 := Unsigned_8'Last;         if Shift_Right_Arithmetic(TC_Val_Unsigned_8, 1) /=             Unsigned_8'Last          then            Report.Failed              ("Incorrect result from BE Shift_Right_Arithmetic - 7");         end if;      else  -- Low-order first bit ordering         -- Case where the parameter Value is less than          -- one half of the modulus.  Zero bits will be shifted in.         TC_Amount            := 1;         TC_Val_Unsigned_8    := 127;  -- Less than one half of modulus.         TC_Result_Unsigned_8 := Shift_Right_Arithmetic(TC_Val_Unsigned_8,                                                        TC_Amount);         if TC_Result_Unsigned_8 /= 254 then            Report.Failed              ("Incorrect result from LE Shift_Right_Arithmetic - 1");         end if;         TC_Val_Unsigned_8 := 2;         if Shift_Right_Arithmetic(TC_Val_Unsigned_8, 2) /=   8  or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 3) /=  16  or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 5) /=  64  or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 8) /=   0  or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 0) /= TC_Val_Unsigned_8           then            Report.Failed              ("Incorrect result from LE Shift_Right_Arithmetic - 2");         end if;         TC_Val_Unsigned_8 := 64;         if Shift_Right_Arithmetic(TC_Val_Unsigned_8, Amount => 1) /= 128 or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 3)           /=   0           then            Report.Failed              ("Incorrect result from LE Shift_Right_Arithmetic - 3");         end if;         -- Case where the parameter Value is greater than or equal to         -- one half of the modulus.  One bits will be shifted in.                TC_Amount            := 1;         TC_Val_Unsigned_8    := 128;  -- One half of modulus.         TC_Result_Unsigned_8 := Shift_Right_Arithmetic(TC_Val_Unsigned_8,                                                        Amount => TC_Amount);         if TC_Result_Unsigned_8 /= 3 then            Report.Failed              ("Incorrect result from LE Shift_Right_Arithmetic - 4");         end if;         TC_Amount            := 1;         TC_Val_Unsigned_8    := 129;  -- Greater than one half of modulus.         TC_Result_Unsigned_8 := Shift_Right_Arithmetic(TC_Val_Unsigned_8,                                                        Amount => TC_Amount);         if TC_Result_Unsigned_8 /= 3 then            Report.Failed              ("Incorrect result from LE Shift_Right_Arithmetic - 5");         end if;         TC_Val_Unsigned_8    := 135;  -- Greater than one half of modulus.         if Shift_Right_Arithmetic(TC_Val_Unsigned_8, 2) /= 31  or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 3) /= 63  or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 5) /= Unsigned_8'Last or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 7) /= Unsigned_8'Last or            Shift_Right_Arithmetic(TC_Val_Unsigned_8, 0) /= TC_Val_Unsigned_8           then            Report.Failed              ("Incorrect result from LE Shift_Right_Arithmetic - 6");         end if;         TC_Val_Unsigned_8 := Unsigned_8'Last;         if Shift_Right_Arithmetic(TC_Val_Unsigned_8, 1) /=             Unsigned_8'Last          then            Report.Failed              ("Incorrect result from LE Shift_Right_Arithmetic - 7");         end if;      end if;      -- Function Rotate_Left.      if Big_Endian then  -- High-order first bit ordering.         TC_Amount            := 1;         TC_Val_Unsigned_8    := 129;           TC_Result_Unsigned_8 := Rotate_Left(Value  => TC_Val_Unsigned_8,                                              Amount => TC_Amount);         if TC_Result_Unsigned_8 /= 3 then            Report.Failed("Incorrect result from BE Rotate_Left - 1");         end if;         if Rotate_Left(TC_Val_Unsigned_8, 2) /=   6  or            Rotate_Left(TC_Val_Unsigned_8, 3) /=  12  or            Rotate_Left(TC_Val_Unsigned_8, 5) /=  48  or            Rotate_Left(TC_Val_Unsigned_8, 8) /= 129  or            Rotate_Left(TC_Val_Unsigned_8, 0) /= TC_Val_Unsigned_8           then            Report.Failed("Incorrect result from BE Rotate_Left - 2");         end if;         TC_Val_Unsigned_8 := 1;         if Rotate_Left(Value => TC_Val_Unsigned_8, Amount => 1) /= 2 or            Rotate_Left(TC_Val_Unsigned_8, Amount => 3)          /= 8          then             Report.Failed("Incorrect result from BE Rotate_Left - 3");         end if;         TC_Val_Unsigned_8 := 82;         if Rotate_Left(TC_Val_Unsigned_8, Amount => 4)       /=  37  or            Rotate_Left(Rotate_Left(TC_Val_Unsigned_8, 7), 1) /=  82         then            Report.Failed("Incorrect result from BE Rotate_Left - 4");         end if;      else   -- Low-order first bit ordering.         TC_Amount            := 1;         TC_Val_Unsigned_8    := 1;         TC_Result_Unsigned_8 := Rotate_Left(TC_Val_Unsigned_8, TC_Amount);         if TC_Result_Unsigned_8 /= 128 then            Report.Failed("Incorrect result from LE Rotate_Left - 1");         end if;         TC_Val_Unsigned_8    := 15;         if Rotate_Left(TC_Val_Unsigned_8, 2) /=  195  or            Rotate_Left(TC_Val_Unsigned_8, 3) /=  225  or            Rotate_Left(TC_Val_Unsigned_8, 5) /=  120  or            Rotate_Left(TC_Val_Unsigned_8, 8) /= TC_Val_Unsigned_8 or            Rotate_Left(TC_Val_Unsigned_8, 0) /= TC_Val_Unsigned_8           then            Report.Failed("Incorrect result from LE Rotate_Left - 2");         end if;         TC_Val_Unsigned_8 := Unsigned_8'Last;         if Rotate_Left(TC_Val_Unsigned_8, 1) /= Unsigned_8'Last then            Report.Failed("Incorrect result from LE Rotate_Left - 3");         end if;         TC_Val_Unsigned_8 := 12;         if Rotate_Left(TC_Val_Unsigned_8, 1) /=   6 or            Rotate_Left(TC_Val_Unsigned_8, 3) /= 129           then            Report.Failed("Incorrect result from LE Rotate_Left - 4");         end if;         TC_Val_Unsigned_8 := 129;         if Rotate_Left(TC_Val_Unsigned_8, 4)                 /=  24  or            Rotate_Left(Rotate_Left(TC_Val_Unsigned_8, 7), 1) /= 129         then            Report.Failed("Incorrect result from LE Rotate_Left - 5");         end if;      end if;      -- Function Rotate_Right.      if Big_Endian then  -- High-order first bit ordering.         TC_Amount            := 1;         TC_Val_Unsigned_8    := 1;         TC_Result_Unsigned_8 := Rotate_Right(TC_Val_Unsigned_8, TC_Amount);         if TC_Result_Unsigned_8 /= 128 then            Report.Failed("Incorrect result from BE Rotate_Right - 1");         end if;         TC_Val_Unsigned_8    := 15;         if Rotate_Right(TC_Val_Unsigned_8, 2) /=  195  or            Rotate_Right(TC_Val_Unsigned_8, 3) /=  225  or            Rotate_Right(TC_Val_Unsigned_8, 5) /=  120  or            Rotate_Right(TC_Val_Unsigned_8, 8) /= TC_Val_Unsigned_8 or            Rotate_Right(TC_Val_Unsigned_8, 0) /= TC_Val_Unsigned_8           then            Report.Failed("Incorrect result from BE Rotate_Right - 2");         end if;         TC_Val_Unsigned_8 := Unsigned_8'Last;         if Rotate_Right(TC_Val_Unsigned_8, 1) /= Unsigned_8'Last then            Report.Failed("Incorrect result from BE Rotate_Right - 3");         end if;         TC_Val_Unsigned_8 := 12;         if Rotate_Right(TC_Val_Unsigned_8, 1) /=   6 or            Rotate_Right(TC_Val_Unsigned_8, 3) /= 129           then            Report.Failed("Incorrect result from BE Rotate_Right - 4");         end if;         TC_Val_Unsigned_8 := 129;         if Rotate_Right(TC_Val_Unsigned_8, 4)                  /=  24  or            Rotate_Right(Rotate_Right(TC_Val_Unsigned_8, 7), 1) /= 129         then            Report.Failed("Incorrect result from BE Rotate_Right - 5");         end if;      else  -- Low-order first bit ordering.         TC_Amount            := 1;         TC_Val_Unsigned_8    := 129;           TC_Result_Unsigned_8 := Rotate_Right(Value  => TC_Val_Unsigned_8,                                               Amount => TC_Amount);         if TC_Result_Unsigned_8 /= 3 then            Report.Failed("Incorrect result from LE Rotate_Right - 1");         end if;         if Rotate_Right(TC_Val_Unsigned_8, 2) /=   6  or            Rotate_Right(TC_Val_Unsigned_8, 3) /=  12  or            Rotate_Right(TC_Val_Unsigned_8, 5) /=  48  or            Rotate_Right(TC_Val_Unsigned_8, 8) /= 129  or            Rotate_Right(TC_Val_Unsigned_8, 0) /= TC_Val_Unsigned_8           then            Report.Failed("Incorrect result from LE Rotate_Right - 2");         end if;         TC_Val_Unsigned_8 := 1;         if Rotate_Right(Value => TC_Val_Unsigned_8, Amount => 1) /= 2 or            Rotate_Right(TC_Val_Unsigned_8, Amount => 3)          /= 8          then             Report.Failed("Incorrect result from LE Rotate_Right - 3");         end if;         TC_Val_Unsigned_8 := 82;         if Rotate_Right(TC_Val_Unsigned_8, Amount => 4)        /=  37  or            Rotate_Right(Rotate_Right(TC_Val_Unsigned_8, 7), 1) /=  82         then            Report.Failed("Incorrect result from LE Rotate_Right - 4");         end if;      end if;      -- Tests of Rotate_Left and Rotate_Right in combination.      if Big_Endian then  -- High-order first bit ordering.         TC_Val_Unsigned_8  := 17;         if Rotate_Left(Rotate_Right(TC_Val_Unsigned_8, 2), 2) /=             TC_Val_Unsigned_8                                        or            Rotate_Left(Rotate_Right(TC_Val_Unsigned_8, 1), 3) /= 68 or            Rotate_Right(Rotate_Left(TC_Val_Unsigned_8, 3), 7) /= 17 or            Rotate_Right(Rotate_Left(TC_Val_Unsigned_8, 2), 8) /= 68          then            Report.Failed("Incorrect result from BE Rotate_Left - " &                          "Rotate_Right functions used in combination");         end if;      else  -- Low-order first bit ordering.         TC_Val_Unsigned_8 := 4;         if Rotate_Left(Rotate_Right(TC_Val_Unsigned_8, 2), 2) /=             TC_Val_Unsigned_8                                        or            Rotate_Left(Rotate_Right(TC_Val_Unsigned_8, 1), 3) /=  1 or            Rotate_Right(Rotate_Left(TC_Val_Unsigned_8, 3), 7) /= 64 or            Rotate_Right(Rotate_Left(TC_Val_Unsigned_8, 2), 8) /=  1          then            Report.Failed("Incorrect result from LE Rotate_Left - " &                          "Rotate_Right functions used in combination");         end if;      end if;   exception      when The_Error : others =>          Report.Failed ("The following exception was raised in the " &                        "Test_Block: " & Exception_Name(The_Error));   end Test_Block;   Report.Result;end CXB2001;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?