コード例 #1
0
        public void Init_NonZeroExponent_ReturnsZero()
        {
            const double expected = 0;
            var          mp       = new MathPower(2.5);

            Assert.AreEqual(
                expected,
                mp[0],
                eps
                );
        }
コード例 #2
0
        public void Init_ZeroExponent_ReturnsOne()
        {
            const double expected = 1;
            var          mp       = new MathPower(0);

            Assert.AreEqual(
                expected,
                mp[0],
                eps
                );
        }
コード例 #3
0
        public void Indexer_PositiveValue87_IsGood(int val)
        {
            const double pow      = 2.5;
            var          mp       = new MathPower(pow);
            var          expected = Math.Pow(val, pow);

            Assert.AreEqual(
                expected,
                mp[val],
                eps
                );
        }
コード例 #4
0
        public void Indexer_NegativeValue_ThrowsNegativeValue()
        {
            double p;

            Assert.Catch <NegativeValueException>(() => p = new MathPower(2)[-2]);
        }