Esempio n. 1
0
        public void SixthBinaryDerivativeTest()
        {
            var arr    = new BitArray(new[] { false, false, false, true, true, true, true, true });
            var result = BHelpers.BinaryDerivative(arr, 6);
            var value  = BHelpers.BitArrayToInteger(result);

            Assert.AreEqual(value, 2);
        }
Esempio n. 2
0
        public void CalculatePTest()
        {
            var p4 = BHelpers.CalculateP(new BitArray(new[] { true, false, true, true }), 0);
            var p3 = BHelpers.CalculateP(new BitArray(new[] { true, true, false }), 0);
            var p2 = BHelpers.CalculateP(new BitArray(new[] { false, true }), 0);

            Assert.AreEqual(Math.Round(p4, 2), 0.75);
            Assert.AreEqual(Math.Round(p3, 2), 0.67);
            Assert.AreEqual(Math.Round(p2, 2), 0.50);
        }