/* ----------------------------------------------------------------------------- Copyright 2020 Kevin P. Barry Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------------------------------- */ // Author: Kevin P. Barry [ta0kira@gmail.com] testcase "sanity check all functions" { success } unittest cos { \ Testing.checkBetween(Math.cos(2.0),-0.42,-0.41) } unittest sin { \ Testing.checkBetween(Math.sin(2.0),0.90,0.91) } unittest tan { \ Testing.checkBetween(Math.tan(2.0),-2.19,-2.18) } unittest acos { \ Testing.checkBetween(Math.acos(0.5),1.04,1.05) } unittest asin { \ Testing.checkBetween(Math.asin(0.5),0.52,0.53) } unittest atan { \ Testing.checkBetween(Math.atan(0.5),0.46,0.47) } unittest cosh { \ Testing.checkBetween(Math.cosh(2.0),3.76,3.77) } unittest sinh { \ Testing.checkBetween(Math.sinh(2.0),3.62,3.63) } unittest tanh { \ Testing.checkBetween(Math.tanh(2.0),0.96,0.97) } unittest acosh { \ Testing.checkBetween(Math.acosh(2.0),1.31,1.32) } unittest asinh { \ Testing.checkBetween(Math.asinh(2.0),1.44,1.45) } unittest atanh { \ Testing.checkBetween(Math.atanh(0.5),0.54,0.55) } unittest exp { \ Testing.checkBetween(Math.exp(1.0),2.71,2.72) } unittest log { \ Testing.checkBetween(Math.log(9.0),2.19,2.20) } unittest log10 { \ Testing.checkBetween(Math.log10(100.0),1.99,2.01) } unittest log2 { \ Testing.checkBetween(Math.log2(8.0),2.99,3.01) } unittest pow { \ Testing.checkBetween(Math.pow(2.0,3.0),7.99,8.01) } unittest sqrt { \ Testing.checkBetween(Math.sqrt(4.0),1.99,2.01) } unittest ceil { \ Testing.checkBetween(Math.ceil(2.2),2.99,3.01) } unittest floor { \ Testing.checkBetween(Math.floor(2.2),1.99,2.01) } unittest fmod { \ Testing.checkBetween(Math.fmod(7.0,4.0),2.99,3.01) } unittest trunc { \ Testing.checkBetween(Math.trunc(2.2),1.99,2.01) } unittest round { \ Testing.checkBetween(Math.round(2.7),2.99,3.01) } unittest fabs { \ Testing.checkBetween(Math.fabs(-10.0),9.99,10.01) } unittest isinf { if (!Math.isinf(Math.log(0.0))) { fail("Failed") } } unittest isnan { if (!Math.isnan(Math.sqrt(-1.0))) { fail("Failed") } } unittest abs { \ Testing.checkEquals(Math.abs(-10),10) \ Testing.checkEquals(Math.abs(10),10) \ Testing.checkEquals(Math.abs(0),0) }