cxf2001.a

来自「用于进行gcc测试」· A 代码 · 共 756 行 · 第 1/2 页

A
756
字号
      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_0001);      begin         if TC_Verbose then Report.Comment("Case 18"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_0001);         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_0001 /= DT_0_0001(0.0012)          then            Report.Failed("Incorrect values returned, Case 18");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_001);      begin         if TC_Verbose then Report.Comment("Case 19"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_001);         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_001 /= DT_0_001(0.001) then            Report.Failed("Incorrect values returned, Case 19");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_01);      begin         if TC_Verbose then Report.Comment("Case 20"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_01);         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_01 /= DT_0_01(0.0) then            Report.Failed("Incorrect values returned, Case 20");         end if;      end;   exception      when others => Report.Failed("Exception raised in Radix_10_Block");   end Radix_10_Block;   Radix_2_Block:   declare      -- Declare all types and variables used in the various blocks below      -- for all Radix 2 evaluations.      type DT_1       is delta 1.0     digits 5;       type DT_0_1     is delta 0.1     digits 10;       type DT_0_01    is delta 0.01    digits 10;       type DT_0_001   is delta 0.001   digits 10;       type DT_0_0001  is delta 0.0001  digits 10;       type DT_0_00001 is delta 0.00001 digits 10;       for DT_1'Machine_Radix       use 2;      for DT_0_1'Machine_Radix     use 2;      for DT_0_01'Machine_Radix    use 2;      for DT_0_001'Machine_Radix   use 2;      for DT_0_0001'Machine_Radix  use 2;      for DT_0_00001'Machine_Radix use 2;      Dd_1,       Dv_1,       Quot_1,       Rem_1       : DT_1       := 0.0;      Dd_0_1,     Dv_0_1,     Quot_0_1,     Rem_0_1     : DT_0_1     := 0.0;      Dd_0_01,    Dv_0_01,    Quot_0_01,    Rem_0_01    : DT_0_01    := 0.0;      Dd_0_001,   Dv_0_001,   Quot_0_001,   Rem_0_001   : DT_0_001   := 0.0;      Dd_0_0001,  Dv_0_0001,  Quot_0_0001,  Rem_0_0001  : DT_0_0001  := 0.0;      Dd_0_00001, Dv_0_00001, Quot_0_00001, Rem_0_00001 : DT_0_00001 := 0.0;   begin       declare         procedure Div is             new Ada.Decimal.Divide(Dividend_Type  => DT_0_01,                                   Divisor_Type   => DT_0_1,                                   Quotient_Type  => DT_0_1,                                   Remainder_Type => DT_0_01);      begin         if TC_Verbose then Report.Comment("Case 21"); end if;         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);         Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_01);         if Quot_0_1 /= DT_0_1(0.1)  or  Rem_0_01 /= DT_0_01(0.02) then            Report.Failed("Incorrect values returned, Case 21");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_1, DT_0_1);      begin         if TC_Verbose then Report.Comment("Case 22"); end if;         Dd_0_01 := DT_0_01(0.05);   Dv_0_1 := DT_0_1(0.3);         Div(Dd_0_01, Dv_0_1, Quot_0_1, Rem_0_1);         if Quot_0_1 /= DT_0_1(0.1) or  Rem_0_1 /= DT_0_1(0.0) then            Report.Failed("Incorrect values returned, Case 22");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_001);      begin         if TC_Verbose then Report.Comment("Case 23"); end if;         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);         Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_001);         if Quot_0_01 /= DT_0_01(0.16) or  Rem_0_001 /= DT_0_001(0.002) then            Report.Failed("Incorrect values returned, Case 23");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_01, DT_0_01);      begin         if TC_Verbose then Report.Comment("Case 24"); end if;         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);         Div(Dd_0_01, Dv_0_1, Quot_0_01, Rem_0_01);         if Quot_0_01 /= DT_0_01(0.16) or  Rem_0_01 /= DT_0_01(0.0) then            Report.Failed("Incorrect values returned, Case 24");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_0_1, DT_0_001, DT_0_0001);      begin         if TC_Verbose then Report.Comment("Case 25"); end if;         Dd_0_01 := DT_0_01(0.05);  Dv_0_1 := DT_0_1(0.3);         Div(Dd_0_01, Dv_0_1, Quot_0_001, Rem_0_0001);         if Quot_0_001 /= DT_0_001(0.166)   or             Rem_0_0001 /= DT_0_0001(0.0002)          then            Report.Failed("Incorrect values returned, Case 25");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_0001);      begin         if TC_Verbose then Report.Comment("Case 26"); end if;         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);         Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_0001);         if Quot_0_01 /= DT_0_01(0.0) or Rem_0_0001 /= DT_0_0001(0.1500) then            Report.Failed("Incorrect values returned, Case 26");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_001);      begin         if TC_Verbose then Report.Comment("Case 27"); end if;         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);         Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_001);         if Quot_0_01 /= DT_0_01(0.0) or Rem_0_001 /= DT_0_001(0.150) then            Report.Failed("Incorrect values returned, Case 27");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_01, DT_0_01);      begin         if TC_Verbose then Report.Comment("Case 28"); end if;         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);         Div(Dd_0_01, Dv_1, Quot_0_01, Rem_0_01);         if Quot_0_01 /= DT_0_01(0.0) or Rem_0_01 /= DT_0_01(0.15) then            Report.Failed("Incorrect values returned, Case 28");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_001);      begin         if TC_Verbose then Report.Comment("Case 29"); end if;         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);         Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_001);         if Quot_0_001 /= DT_0_001(0.007) or  Rem_0_001 /= DT_0_001(0.01) then            Report.Failed("Incorrect values returned, Case 29");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_001, DT_0_01);      begin         if TC_Verbose then Report.Comment("Case 30"); end if;         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);         Div(Dd_0_01, Dv_1, Quot_0_001, Rem_0_01);         if Quot_0_001 /= DT_0_001(0.007) or  Rem_0_01 /= DT_0_01(0.01) then            Report.Failed("Incorrect values returned, Case 30");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_01, DT_1, DT_0_0001, DT_0_0001);      begin         if TC_Verbose then Report.Comment("Case 31"); end if;         Dd_0_01 := DT_0_01(0.15);  Dv_1 := DT_1(20);         Div(Dd_0_01, Dv_1, Quot_0_0001, Rem_0_0001);         if Quot_0_0001 /= DT_0_0001(0.0075) or             Rem_0_0001  /= DT_0_0001(0.0)          then            Report.Failed("Incorrect values returned, Case 31");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_0001, DT_0_0001);      begin         if TC_Verbose then Report.Comment("Case 32"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_0001, Rem_0_0001);         if Quot_0_0001 /= DT_0_0001(0.0625) or             Rem_0_0001  /= DT_0_0001(0.0)          then            Report.Failed("Incorrect values returned, Case 32");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_00001);      begin         if TC_Verbose then Report.Comment("Case 33"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_00001);         if Quot_0_001 /= DT_0_001(0.062) or             Rem_0_00001  /= DT_0_00001(0.00025)         then            Report.Failed("Incorrect values returned, Case 33");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_0001);      begin         if TC_Verbose then Report.Comment("Case 34"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_0001);         if Quot_0_001 /= DT_0_001(0.062) or             Rem_0_0001  /= DT_0_0001(0.0002)         then            Report.Failed("Incorrect values returned, Case 34");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_001);      begin         if TC_Verbose then Report.Comment("Case 35"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_001);         if Quot_0_001 /= DT_0_001(0.062) or Rem_0_001 /= DT_0_001(0.000)         then            Report.Failed("Incorrect values returned, Case 35");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_001, DT_0_01);      begin         if TC_Verbose then Report.Comment("Case 36"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_001, Rem_0_01);         if Quot_0_001 /= DT_0_001(0.062) or Rem_0_01 /= DT_0_01(0.00) then            Report.Failed("Incorrect values returned, Case 36");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_00001);      begin         if TC_Verbose then Report.Comment("Case 37"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_00001);         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_00001 /= DT_0_00001(0.00125)          then            Report.Failed("Incorrect values returned, Case 37");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_0001);      begin         if TC_Verbose then Report.Comment("Case 38"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_0001);         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_0001 /= DT_0_0001(0.0012)          then            Report.Failed("Incorrect values returned, Case 38");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_001);      begin         if TC_Verbose then Report.Comment("Case 39"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_001);         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_001 /= DT_0_001(0.001) then            Report.Failed("Incorrect values returned, Case 39");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_00001, DT_0_1, DT_0_01, DT_0_01);      begin         if TC_Verbose then Report.Comment("Case 40"); end if;         Dd_0_00001 := DT_0_00001(0.03125);  Dv_0_1 := DT_0_1(0.5);         Div(Dd_0_00001, Dv_0_1, Quot_0_01, Rem_0_01);         if Quot_0_01 /= DT_0_01(0.06) or Rem_0_01 /= DT_0_01(0.0) then            Report.Failed("Incorrect values returned, Case 40");         end if;      end;      declare         procedure Div is             new Ada.Decimal.Divide(DT_0_0001, DT_1, DT_0_0001, DT_0_0001);      begin         if TC_Verbose then Report.Comment("Case 41"); end if;         Dd_0_0001 := (DT_0_0001(6062.0) / DT_0_0001(16384.0));           Dv_1 := DT_1(0.0);         Div(Dd_0_0001, Dv_1, Quot_0_0001, Rem_0_0001);         Report.Failed("Divide by Zero didn't raise Constraint_Error, " &                       "Case 41");      exception         when Constraint_Error =>  null;  -- OK, expected exception.         when others =>             Report.Failed("Unexpected exception raised by Divide by Zero," &                          "Case 41");      end;   exception      when others => Report.Failed("Exception raised in Radix_10_Block");   end Radix_2_Block;   Report.Result;end CXF2001;

⌨️ 快捷键说明

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