cxa5a08.a
来自「用于进行gcc测试」· A 代码 · 共 475 行 · 第 1/2 页
A
475 行
-- Check the results of the Arccot function with specified cycle -- parameter. -- Check that the Arccot function with specified Cycle parameter -- raises Argument_Error when the value of the Cycle parameter is zero -- or negative. begin Float_Result := EF.Arccot(X => Pi, Cycle => 0.0); -- Default Y value Report.Failed("Argument_Error not raised by the Arccot function " & "with default Y parameter value, when the Cycle " & "parameter is 0.0"); Dont_Optimize_Float(Float_Result, 10); exception when Argument_Error => null; -- OK, expected exception. when others => Report.Failed("Incorrect exception raised by the Arccot " & "function with default Y parameter value, when " & "provided a 0.0 cycle parameter value"); end; begin New_Float_Result := GEF.Arccot(X => Pi, Y => 1.0, Cycle => 0.0); Report.Failed("Argument_Error not raised by the Arccot function " & "when the Cycle parameter is 0.0"); Dont_Optimize_New_Float(New_Float_Result, 11); exception when Argument_Error => null; -- OK, expected exception. when others => Report.Failed("Incorrect exception raised by the Arccot " & "function when provided a 0.0 cycle parameter " & "value"); end; begin Float_Result := EF.Arccot(X => Pi, Cycle => -360.0); Report.Failed("Argument_Error not raised by the Arccot function " & "with a default Y parameter value, when the Cycle " & "parameter is -360.0"); Dont_Optimize_Float(Float_Result, 12); exception when Argument_Error => null; -- OK, expected exception. when others => Report.Failed("Incorrect exception raised by the Arccot " & "function with a default Y parameter value, when " & "provided a -360.0 cycle parameter value"); end; begin New_Float_Result := GEF.Arccot(X => Pi, Y => 1.0, Cycle => -Pi); Report.Failed("Argument_Error not raised by the Arccot function " & "when the Cycle parameter is -Pi"); Dont_Optimize_New_Float(New_Float_Result, 13); exception when Argument_Error => null; -- OK, expected exception. when others => Report.Failed("Incorrect exception raised by the Arccot " & "function when provided a -Pi cycle parameter " & "value"); end; -- Check that no exception is raised by the Arccot function with -- specified Cycle parameter, when provided large and small positive -- or negative parameter values for both X and Y input parameters. begin Float_Result := EF.Arccot(X => -FXA5A00.Large, Y => -FXA5A00.Large,--pwb-math Next line: changed 2.0*Pi to 360.0 Cycle => 360.0); Dont_Optimize_Float(Float_Result, 14); exception when others => Report.Failed("Exception raised when the Arccot function with " & "specified Cycle parameter, when provided large " & "negative X and Y parameter values"); end; begin New_Float_Result := GEF.Arccot(New_Float(FXA5A00.Large), Y => New_Float(-FXA5A00.Small),--pwb-math Next line: changed 2.0*Pi to 360.0 Cycle => 360.0); Dont_Optimize_New_Float(New_Float_Result, 15); exception when others => Report.Failed("Exception raised when the Arccot function with " & "specified Cycle parameter, when provided large " & "positive X parameter value and a small negative " & "Y parameter value"); end; begin Float_Result := EF.Arccot(X => -FXA5A00.Small, Y => -FXA5A00.Large,--pwb-math Next line: changed 2.0*Pi to 360.0 Cycle => 360.0); Dont_Optimize_Float(Float_Result, 16); exception when others => Report.Failed("Exception raised when the Arccot function with " & "specified Cycle parameter, when provided small " & "negative X parameter value and a large negative " & "Y parameter value"); end; begin New_Float_Result := GEF.Arccot(New_Float(FXA5A00.Small), New_Float(FXA5A00.Large), --pwb-math Next line: changed 2.0*Pi to 360.0 360.0); Dont_Optimize_New_Float(New_Float_Result, 17); exception when others => Report.Failed("Exception raised when the Arccot function with " & "specified Cycle parameter, when provided a " & "small positive X parameter value and a large " & "positive Y parameter value"); end; -- Check that the Arccot function with specified Cycle parameter -- provides correct results when provided a variety of X parameter -- input values. if not FXA5A00.Result_Within_Range(GEF.Arccot( 0.0, Cycle => 360.0), 90.0, 0.001) or not FXA5A00.Result_Within_Range(EF.Arccot( 0.0, Cycle => 100.0), 25.0, 0.001) or not FXA5A00.Result_Within_Range(GEF.Arccot( 1.0, Cycle => 360.0), 45.0, 0.001) or not FXA5A00.Result_Within_Range(EF.Arccot( 1.0, Cycle => 100.0), 12.5, 0.001) or not FXA5A00.Result_Within_Range(GEF.Arccot(-1.0, Cycle => 360.0), 135.0, 0.001) or not FXA5A00.Result_Within_Range(EF.Arccot(-1.0, Cycle => 100.0), 37.5, 0.001) then Report.Failed("Incorrect results from the Arccot function with " & "specified Cycle parameter when provided a variety " & "of X parameter values"); end if; if not FXA5A00.Result_Within_Range(EF.Arccot(0.2425355, 0.9701420), EF.Arccot(0.25), 0.01) or not FXA5A00.Result_Within_Range(EF.Arccot(0.3162277, 0.9486831), Ef.Arccot(0.33), 0.01) then Report.Failed("Incorrect results from the Arccot function with " & "comparison to other Arccot function results"); end if; if not FXA5A00.Result_Within_Range(EF.Cot(EF.Arccot(0.4472135, 0.8944270)), 0.5, 0.01) or not FXA5A00.Result_Within_Range(EF.Cot(EF.Arccot(0.9987380, 0.0499369)), 20.0, 0.1) then Report.Failed("Incorrect results from the Arccot function when " & "used as argument to Cot function"); end if; -- Check that inverse function results are correct. -- Default Cycle test. Angle := 0.001; while Angle < Pi and not Incorrect_Inverse loop if not Result_Within_Range(EF.Arccot(EF.Cot(Angle)), Angle, 0.001) then Incorrect_Inverse := True; end if; Angle := Angle + 0.001; end loop; if Incorrect_Inverse then Report.Failed("Incorrect results returned from the Inverse " & "comparison of Cot and Arccot using the default " & "cycle value"); Incorrect_Inverse := False; end if; -- Non-Default Cycle test. New_Float_Angle := 0.01; while New_Float_Angle < 180.0 and not Incorrect_Inverse loop if not Result_Within_Range(EF.Arccot(EF.Cot(Float(New_Float_Angle), Cycle => 360.0), Cycle => 360.0), Float(New_Float_Angle), 0.01) or not Result_Within_Range(GEF.Arccot( New_Float(GEF.Cot(New_Float_Angle, Cycle => 360.0)), Cycle => 360.0), Float(New_Float_Angle), 0.01) then Incorrect_Inverse := True; end if; New_Float_Angle := New_Float_Angle + 0.01; end loop; if Incorrect_Inverse then Report.Failed("Incorrect results returned from the Inverse " & "comparison of Cot and Arccot using non-default " & "cycle value"); 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 CXA5A08;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?