cxa5a09.a

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

A
401
字号
         Report.Failed("Incorrect inverse result comparing ""**"" and " &                       "Log function over argument range 1.0..1000.0");      end if;      -- Testing of Log Function, with specified Base parameter, both       -- instantiated and pre-instantiated versions.      -- Check that Argument_Error is raised by the Log function with       -- specified Base parameter, when the X parameter value is negative.      begin         New_Float_Result := GEF.Log(X => -1.0, Base => 16.0);         Report.Failed("Argument_Error not raised by the Log function " &                       "with Base parameter, when the input parameter " &                       "value is -1.0");         Dont_Optimize_New_Float(New_Float_Result, 4);      exception         when Argument_Error => null;  -- OK, expected exception.         when others         =>             Report.Failed("Unexpected exception raised by the Log function " &                          "with Base parameter, when the X parameter value " &                          "is -1.0");      end;      begin         Float_Result := EF.Log(X => -FXA5A00.Large, Base => 8.0);         Report.Failed("Argument_Error not raised by the Log function " &                       "with Base parameter, when the X parameter "     &                       "value is a large negative value");         Dont_Optimize_Float(Float_Result, 5);      exception         when Argument_Error => null;  -- OK, expected exception.         when others         =>             Report.Failed("Unexpected exception raised by the Log function " &                          "with Base parameter, when the X parameter "       &                          "value is a large negative value");      end;      -- Check that Argument_Error is raised by the Log function when       -- the specified Base parameter is zero.      begin         New_Float_Result := GEF.Log(X => 10.0, Base => 0.0);         Report.Failed("Argument_Error not raised by the Log function " &                       "with Base parameter of 0.0");         Dont_Optimize_New_Float(New_Float_Result, 6);      exception         when Argument_Error => null;  -- OK, expected exception.         when others         =>             Report.Failed("Unexpected exception raised by the Log function " &                          "with Base parameter of 0.0");      end;      -- Check that Argument_Error is raised by the Log function when       -- the specified Base parameter is one.      begin         Float_Result := EF.Log(X => 12.3, Base => 1.0);         Report.Failed("Argument_Error not raised by the Log function " &                       "with Base parameter of 1.0");         Dont_Optimize_Float(Float_Result, 7);      exception         when Argument_Error => null;  -- OK, expected exception.         when others         =>             Report.Failed("Unexpected exception raised by the Log function " &                          "with Base parameter of 1.0");      end;      -- Check that Argument_Error is raised by the Log function when       -- the specified Base parameter is negative.      begin         New_Float_Result := GEF.Log(X => 12.3, Base => -10.0);         Report.Failed("Argument_Error not raised by the Log function " &                       "with negative Base parameter");         Dont_Optimize_New_Float(New_Float_Result, 8);      exception         when Argument_Error => null;  -- OK, expected exception.         when others         =>             Report.Failed("Unexpected exception raised by the Log function " &                          "with negative Base parameter");      end;      -- Check that Constraint_Error is raised by the Log function when the      -- input X parameter value is 0.0.      if New_Float'Machine_Overflows = True then         begin            New_Float_Result := GEF.Log(X => 0.0, Base => 16.0);            Report.Failed("Constraint_Error not raised by the Log function "  &                          "with specified Base parameter, when the value of " &                          "the parameter X is 0.0");            Dont_Optimize_New_Float(New_Float_Result, 9);         exception            when Constraint_Error => null;  -- OK, expected exception.            when others           =>               Report.Failed("Unexpected exception raised by Function Log"    &                             "with specified Base parameter, when the value " &                             "of the parameter X is 0.0");         end;      end if;      -- Check for the prescribed results of the Log function with specified      -- Base parameter.      if GEF.Log(X => 1.0, Base => 16.0) /= 0.0 or          EF.Log(X => 1.0, Base => 10.0) /= 0.0 or         GEF.Log(1.0, Base => 8.0)       /= 0.0 or          EF.Log(1.0, 2.0)               /= 0.0      then         Report.Failed("Incorrect result from Function Log with specified " &                       "Base parameter when provided an parameter X input " &                       "value of 1.0");      end if;      -- Check that the Log function with specified Base parameter provides       -- correct results when provided a variety of input parameters.      if not Result_Within_Range(GEF.Log( 10.0,  e),     2.30,  0.01)  or         not Result_Within_Range( EF.Log(  8.0,  2.0),   3.0,   0.01)  or         not Result_Within_Range(GEF.Log(256.0,  2.0),   8.0,   0.01)  or         not Result_Within_Range( EF.Log(512.0,  8.0),   3.0,   0.01)  or         not Result_Within_Range(GEF.Log(0.5649, e),    -0.57,  0.01)  or         not Result_Within_Range( EF.Log(1.7714, e),     0.57,  0.01)  or         not Result_Within_Range(GEF.Log(0.5718, 10.0), -0.243, 0.001) or         not Result_Within_Range( EF.Log(466.25, 10.0),  2.67,  0.01)       then         Report.Failed("Incorrect results from Function Log with specified " &                       "Base parameter, when provided a variety of input "   &                       "parameter values");      end if;      Arg := 1.0;      while Arg < 1000.0 and             not (Incorrect_Inverse_Base_2  and Incorrect_Inverse_Base_8 and                 Incorrect_Inverse_Base_10 and Incorrect_Inverse_Base_16)       loop         if not FXA5A00.Result_Within_Range(EF."**"(2.0,EF.Log(Arg,2.0)),                                            Arg,                                            0.001)          then            Incorrect_Inverse_Base_2 := True;         end if;         if not FXA5A00.Result_Within_Range(EF."**"(8.0,EF.Log(Arg,8.0)),                                            Arg,                                            0.001)          then            Incorrect_Inverse_Base_8 := True;         end if;         if not FXA5A00.Result_Within_Range(EF."**"(10.0,EF.Log(Arg,10.0)),                                            Arg,                                            0.001)          then            Incorrect_Inverse_Base_10 := True;         end if;         if not FXA5A00.Result_Within_Range(EF."**"(16.0,EF.Log(Arg,16.0)),                                             Arg,                                            0.001)          then            Incorrect_Inverse_Base_16 := True;         end if;         Arg := Arg + 1.0;      end loop;      if Incorrect_Inverse_Base_2 then         Report.Failed("Incorrect inverse result comparing ""**"" and " &                       "Log function for Base 2");      end if;      if Incorrect_Inverse_Base_8 then         Report.Failed("Incorrect inverse result comparing ""**"" and " &                       "Log function for Base 8");      end if;      if Incorrect_Inverse_Base_10 then         Report.Failed("Incorrect inverse result comparing ""**"" and " &                       "Log function for Base 10");      end if;      if Incorrect_Inverse_Base_16 then         Report.Failed("Incorrect inverse result comparing ""**"" and " &                       "Log function for Base 16");      end if;   exception      when others => Report.Failed ("Exception raised in Test_Block");   end Test_Block;   Report.Result;end CXA5A09;

⌨️ 快捷键说明

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