Пример #1
0
        public void IsFinite_WithDoubleNegativeInfinity_ReturnFalse()
        {
            // arrange
            const double Value = double.NegativeInfinity;

            // action
            var isFinite = ScalarPrimitives <double, double> .IsFiniteFunc(Value);

            // assert
            Assert.IsFalse(isFinite);
        }
Пример #2
0
        public void Sqrt_Double_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Sqrt(9);

            // assert
            Assert.AreEqual(3.0, result);
        }
Пример #3
0
        public void Add_Double_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Add(3.0, 4.0);

            // assert
            Assert.AreEqual(7.0, result);
        }
Пример #4
0
        public void Atan_Int_ReturnInt()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Atan(-2);

            // assert
            Assert.AreEqual(-1, result);
        }
Пример #5
0
        public void Tanh_Int_ReturnInt()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Tanh(1);

            // assert
            Assert.AreEqual(0, result);
        }
Пример #6
0
        public void Exp_Double_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Exp(1);

            // assert
            Assert.AreEqual(Math.E, result);
        }
Пример #7
0
        public void Cos_Int_ReturnInt()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Cos(0);

            // assert
            Assert.AreEqual(1, result);
        }
Пример #8
0
        public void Divide_NegativeDoubleDivideByZero_ReturnNegativeInfinity()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Divide(-3.0, 0.0);

            // assert
            Assert.AreEqual(double.NegativeInfinity, result);
        }
Пример #9
0
        public void Divide_DoubleDivide_ReturnNan()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Divide(0.0, 0.0);

            // assert
            Assert.AreEqual(double.NaN, result);
        }
Пример #10
0
        public void Multiply_Int_ReturnInt()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Multiply(3, 4);

            // assert
            Assert.AreEqual(12, result);
        }
Пример #11
0
        public void Divide_Double_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Divide(3.0, 4.0);

            // assert
            Assert.AreEqual(0.75, result);
        }
Пример #12
0
        public void IsFinite_WithFloatNegativeInfinity_ReturnFalse()
        {
            // arrange
            const float Value = float.NegativeInfinity;

            // action
            var isFinite = ScalarPrimitives <float, float> .IsFiniteFunc(Value);

            // assert
            Assert.IsFalse(isFinite);
        }
Пример #13
0
        public void Subtract_Double_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Subtract(3, 4);

            // assert
            Assert.AreEqual(-1.0, result);
        }
Пример #14
0
        public void IsFinite_WithFloatValue_ReturnTrue()
        {
            // arrange
            const float Value = 1.0f;

            // action
            var isFinite = ScalarPrimitives <float, float> .IsFiniteFunc(Value);

            // assert
            Assert.IsTrue(isFinite);
        }
Пример #15
0
        public void Log_DoubleNegative_ReturnNan()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Log(-1.0);

            // assert
            Assert.AreEqual(double.NaN, result);
        }
Пример #16
0
        public void Modulo_IntCase2_ReturnInt()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Modulo(4, 3);

            // assert
            Assert.AreEqual(1, result);
        }
Пример #17
0
        public void Log10_Double_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Log10(10);

            // assert
            Assert.AreEqual(1.0, result);
        }
Пример #18
0
        public void Modulo_DoubleCase2_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Modulo(4.0, 3.0);

            // assert
            Assert.AreEqual(1.0, result);
        }
Пример #19
0
        public void Sin_Double_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Sin(Math.PI / 2.0);

            // assert
            Assert.AreEqual(1.0, result);
        }
Пример #20
0
        public void Modulo_DoubleByZero_ReturnNan()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Modulo(4.0, 0.0);

            // assert
            Assert.AreEqual(double.NaN, result);
        }
Пример #21
0
        public void Cos_Double_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Cos(Math.PI);

            // assert
            Assert.AreEqual(-1.0, result);
        }
Пример #22
0
        public void Sign_IntNegative_ReturnInt()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Sign(-3);

            // assert
            Assert.AreEqual(-1, result);
        }
Пример #23
0
        public void Add_Int_ReturnInt()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Add(3, 4);

            // assert
            Assert.AreEqual(7, result);
        }
Пример #24
0
        public void Sign_DoubleNegative_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Sign(-3.0);

            // assert
            Assert.AreEqual(-1.0, result);
        }
Пример #25
0
        public void Sqrt_Int_ReturnInt()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Sqrt(9);

            // assert
            Assert.AreEqual(3, result);
        }
Пример #26
0
        public void Log_Double0_ReturnNegativeInfinity()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Log(0.0);

            // assert
            Assert.AreEqual(double.NegativeInfinity, result);
        }
Пример #27
0
        public void Ceiling_Int_ReturnInt()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Ceiling(9);

            // assert
            Assert.AreEqual(9, result);
        }
Пример #28
0
        public void Log_IntNegative_ReturnIntMin()
        {
            // arrange
            var sp = new ScalarPrimitives <int, int>();

            // action
            var result = sp.Log(-1);

            // assert
            Assert.AreEqual(int.MinValue, result);
        }
Пример #29
0
        public void Ceiling_DoublePositive_ReturnDouble()
        {
            // arrange
            var sp = new ScalarPrimitives <double, double>();

            // action
            var result = sp.Ceiling(1.01);

            // assert
            Assert.AreEqual(2.0, result);
        }
Пример #30
0
        public void IsFinite_WithDoubleValue_ReturnTrue()
        {
            // arrange
            const double Value = 1.0;

            // action
            var isFinite = ScalarPrimitives <double, double> .IsFiniteFunc(Value);

            // assert
            Assert.IsTrue(isFinite);
        }