cxa5a03.a
来自「用于进行gcc测试」· A 代码 · 共 427 行 · 第 1/2 页
A
427 行
when others => Report.Failed("Unexpected exception on GEF.Tan with large " & "positive value"); end; begin The_Result := EF.Tan (FXA5A00.Minus_Large, Cycle => 360.0); Dont_Optimize_Float(The_Result, 9); exception when others => Report.Failed("Unexpected exception on EF.Tan with large " & "negative value"); end; -- Check prescribed result from Tan function with Cycle parameter. if GEF.Tan(0.0, 360.0) /= 0.0 or EF.Tan(0.0, Cycle => 360.0) /= 0.0 then Report.Failed("Incorrect result from Tan function with cycle " & "parameter, using a zero value input parameter"); end if; -- Check the Tan function, with specified Cycle parameter, with a -- variety of input parameters. if not Result_Within_Range(GEF.Tan(30.0, 360.0), 0.577, 0.001) or not Result_Within_Range( EF.Tan(57.0, 360.0), 1.540, 0.001) or not Result_Within_Range(GEF.Tan(115.0, 360.0), -2.145, 0.001) or not Result_Within_Range( EF.Tan(299.0, 360.0), -1.804, 0.001) or not Result_Within_Range(GEF.Tan(390.0, 360.0), 0.577, 0.001) or not Result_Within_Range( EF.Tan(520.0, 360.0), -0.364, 0.001) then Report.Failed("Incorrect result from the Tan function with " & "cycle parameter, with various input parameter " & "values"); end if; -- Testing of Tanh Function, both instantiated and pre-instantiated -- version. -- Check that no exception occurs on computing the Tan with very -- large (positive and negative) input values. begin New_Float_Result := GEF.Tanh (New_Float(FXA5A00.Large)); Dont_Optimize_New_Float(New_Float_Result, 10); exception when others => Report.Failed("Unexpected exception on GEF.Tanh with large " & "positive value"); end; begin The_Result := EF.Tanh (FXA5A00.Minus_Large); Dont_Optimize_Float(The_Result, 11); exception when others => Report.Failed("Unexpected exception on EF.Tanh with large " & "negative value"); end; -- Check for prescribed result of Tanh with zero value input parameter. if GEF.Tanh (0.0) /= 0.0 or EF.Tanh (0.0) /= 0.0 then Report.Failed("Incorrect result from Tanh with zero parameter"); end if; -- Check the results of the Tanh function with various input -- parameters. if not (FXA5A00.Result_Within_Range(GEF.Tanh(2.99), 0.995, 0.001) and FXA5A00.Result_Within_Range(GEF.Tanh(0.130), 0.129, 0.001) and FXA5A00.Result_Within_Range( EF.Tanh(Pi), 0.996, 0.001) and FXA5A00.Result_Within_Range( EF.Tanh(-Pi), -0.996, 0.001) and FXA5A00.Result_Within_Range(GEF.Tanh(0.60), 0.537, 0.001) and FXA5A00.Result_Within_Range( EF.Tanh(1.04), 0.778, 0.001) and FXA5A00.Result_Within_Range(GEF.Tanh(1.55), 0.914, 0.001) and FXA5A00.Result_Within_Range( EF.Tanh(-2.14), -0.973, 0.001)) then Report.Failed("Incorrect result from Tanh function with various " & "input parameters"); end if; -- Testing of Arctanh Function, both instantiated and pre-instantiated -- version. -- Check that Constraint_Error is raised by the Arctanh function -- when the absolute value of the parameter X is one. if New_Float'Machine_Overflows = True then begin New_Float_Result := GEF.Arctanh(X => 1.0); Report.Failed("Constraint_Error not raised by Function Arctanh " & "when provided a parameter value of 1.0"); Dont_Optimize_New_Float(New_Float_Result, 12); exception when Constraint_Error => null; -- OK, expected exception. when others => Report.Failed("Unexpected exception raised by Function Arctanh " & "when provided a parameter value of 1.0"); end; end if; if Float'Machine_Overflows = True then begin The_Result := EF.Arctanh(-1.0); Report.Failed("Constraint_Error not raised by Function Arctanh " & "when provided a parameter value of -1.0"); Dont_Optimize_Float(The_Result, 13); exception when Constraint_Error => null; -- OK, expected exception. when others => Report.Failed("Unexpected exception raised by Function Arctanh " & "when provided a parameter value of -1.0"); end; end if; -- Check that Function Arctanh raises Argument_Error when the absolute -- value of the parameter X exceeds one. begin New_Float_Result := GEF.Arctanh(New_Float(FXA5A00.One_Plus_Delta)); Report.Failed("Argument_Error not raised by Function Arctanh " & "when provided a parameter value greater than 1.0"); Dont_Optimize_New_Float(New_Float_Result, 14); exception when Argument_Error => null; -- OK, expected exception. when others => Report.Failed("Unexpected exception raised by Function Arctanh " & "when provided a parameter value greater than 1.0"); end; begin The_Result := EF.Arctanh(FXA5A00.Minus_One_Minus_Delta); Report.Failed("Argument_Error not raised by Function Arctanh " & "when provided a parameter value less than -1.0"); Dont_Optimize_Float(The_Result, 15); exception when Argument_Error => null; -- OK, expected exception. when others => Report.Failed("Unexpected exception raised by Function Arctanh " & "when provided a parameter value less than -1.0"); end; begin New_Float_Result := GEF.Arctanh(New_Float(FXA5A00.Large)); Report.Failed("Argument_Error not raised by Function Arctanh " & "when provided a large positive parameter value"); Dont_Optimize_New_Float(New_Float_Result, 16); exception when Argument_Error => null; -- OK, expected exception. when others => Report.Failed("Unexpected exception raised by Function Arctanh " & "when provided a large positive parameter value"); end; begin The_Result := EF.Arctanh(FXA5A00.Minus_Large); Report.Failed("Argument_Error not raised by Function Arctanh " & "when provided a large negative parameter value"); Dont_Optimize_Float(The_Result, 17); exception when Argument_Error => null; -- OK, expected exception. when others => Report.Failed("Unexpected exception raised by Function Arctanh " & "when provided a large negative parameter value"); end; -- Prescribed results for Function Arctanh with zero input value. if GEF.Arctanh(0.0) /= 0.0 or EF.Arctanh(0.0) /= 0.0 then Report.Failed("Incorrect result from Function Arctanh with a " & "parameter value of zero"); end if; -- Check the results of the Arctanh function with various input -- parameters. if not (Result_Within_Range(GEF.Arctanh(0.15), 0.151, 0.001) and Result_Within_Range( EF.Arctanh(0.44), 0.472, 0.001) and Result_Within_Range(GEF.Arctanh(0.81), 1.127, 0.001) and Result_Within_Range( EF.Arctanh(0.99), 2.647, 0.001)) then Report.Failed("Incorrect result from Arctanh function with " & "various input parameters"); end if; exception when others => Report.Failed ("Exception raised in Test_Block"); end Test_Block; Report.Result;end CXA5A03;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?