Ejemplo n.º 1
0
        public void Wildcards(string[] wildcardStrs, string[] matches, string[] notMatches)
        {
            var wildcards = new Wildcards <Wildcard>(wildcardStrs.Select(wildcardStr => new Wildcard(wildcardStr)));

            foreach (var match in matches)
            {
                Assert.True(wildcards.Contains(match));
            }
            foreach (var notMatch in notMatches)
            {
                Assert.False(wildcards.Contains(notMatch));
            }
        }
Ejemplo n.º 2
0
        private bool[] GetIntermediateBits(BitValue bv)
        {
            var interBits = new bool[bv.Bits.Length];

            for (byte i = 0; i < interBits.Length; i++)
            {
                if (Wildcards.Contains(i))
                {
                    interBits[i] = false; //< Setting false to 'take' the 0 value first
                }
                else if (Mask.ContainsKey(i))
                {
                    //< If the mask is 1 -> set to 1, else retain original value
                    interBits[i] = Mask[i] ? true : bv.Bits[i];
                }
                else
                {
                    interBits[i] = bv.Bits[i];
                }
            }
            return(interBits);
        }