public void CosShouldReturnCorrectResult() { var func = new Cos(); var args = FunctionsHelper.CreateArgs(2); var result = func.Execute(args, _parsingContext); var roundedResult = Math.Round((double)result.Result, 9); Assert.AreEqual(-0.416146837d, roundedResult); }
public void DoubleFunctionCos() { var sut = new Cos(); var result = sut.Execute(new List <Accumulator> { new Accumulator(Math.PI / 3) }); Assert.AreEqual(Math.Cos(Math.PI / 3), result.ValueAsDouble()); }
public void CosWithInvalidArgumentReturnsPoundValue() { var func = new Cos(); var parsingContext = ParsingContext.Create(); var args = FunctionsHelper.CreateArgs(); var result = func.Execute(args, parsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void ExecuteComplexNumberTest() { var complex = new Complex(3, 2); var exp = new Cos(new ComplexNumber(complex)); var result = (Complex)exp.Execute(); Assert.Equal(Complex.Cos(complex), result); Assert.Equal(-3.7245455049153224, result.Real, 14); Assert.Equal(-0.51182256998738462, result.Imaginary, 14); }
public void ExecuteTestException() { var exp = new Cos(new Bool(false)); Assert.Throws <ResultIsNotSupportedException>(() => exp.Execute()); }
public void ExecuteGradianTest() { var exp = new Cos(new Number(1)); Assert.Equal(Math.Cos(1 * Math.PI / 200), exp.Execute(AngleMeasurement.Gradian)); }
public void ExecuteDegreeTest() { var exp = new Cos(new Number(1)); Assert.Equal(Math.Cos(1 * Math.PI / 180), exp.Execute(AngleMeasurement.Degree)); }