Ejemplo n.º 1
0
        public void And_ByteArray_ShouldDoNothing_WhenNotSameLength()
        {
            var bitString = new BitString("10101010");
            var bytes     = new byte[] { 0, 0 };

            bitString.And(bytes);
            Assert.AreEqual("10101010", bitString.ToBinString());
        }
Ejemplo n.º 2
0
        public void And_ByteArray_ShouldDoNothing_WhenNullData()
        {
            var bitString = new BitString("10101010");

            byte[] bytes = null;
            bitString.And(bytes);
            Assert.AreEqual("10101010", bitString.ToBinString());
        }
Ejemplo n.º 3
0
        public void And_Bitstring_ShouldDoNothing_WhenNotSameLength()
        {
            var bitString = new BitString("10101010");
            var other     = new BitString("1010");

            bitString.And(other);
            Assert.AreEqual("10101010", bitString.ToBinString());
        }
Ejemplo n.º 4
0
        public void And_ByteArray_ShouldAndCurrentInstanceWithData()
        {
            var bitString = new BitString("10101010");
            var bytes     = new byte[] { 195 };         // = "11000011"

            bitString.And(bytes);
            Assert.AreEqual("10000010", bitString.ToBinString());
        }
Ejemplo n.º 5
0
        public List<ulong> GetAllConnections3(params ulong[] linksToConnect)
        {
            return _sync.ExecuteReadOperation(() =>
            {
                var results = new BitString((long)_links.Total + 1); // new BitArray((int)_links.Total + 1);

                if (linksToConnect.Length > 0)
                {
                    EnsureEachLinkExists(_links, linksToConnect);

                    var collector1 = new AllUsagesCollector2(_links, results);
                    collector1.Collect(linksToConnect[0]);

                    for (int i = 1; i < linksToConnect.Length; i++)
                    {
                        var next = new BitString((long)_links.Total + 1); //new BitArray((int)_links.Total + 1);
                        var collector = new AllUsagesCollector2(_links, next);
                        collector.Collect(linksToConnect[i]);

                        results = results.And(next);
                    }
                }

                return results.GetSetUInt64Indices();
            });
        }