Beispiel #1
0
 public void ShouldReturnExpectedRankRankingForEveryPermutation()
 {
     ICard[] ranks =
     {
         new Card(Suit.Club, Rank.Two),
         new Card(Suit.Club, Rank.Three),
         new Card(Suit.Club, Rank.Four),
         new Card(Suit.Club, Rank.Five),
         new Card(Suit.Club, Rank.Six),
         new Card(Suit.Club, Rank.Seven),
         new Card(Suit.Club, Rank.Eight),
         new Card(Suit.Club, Rank.Nine),
         new Card(Suit.Club, Rank.Ten),
         new Card(Suit.Club, Rank.Jack),
         new Card(Suit.Club, Rank.Queen),
         new Card(Suit.Club, Rank.King),
         new Card(Suit.Club, Rank.Ace)
     };
     for (int thisIdx = 0; thisIdx < ranks.Length; thisIdx++)
     {
         for (int otherIdx = 0; otherIdx < ranks.Length; otherIdx++)
         {
             IValueCompare compare = ranks[thisIdx].Compare(ranks[otherIdx]);
             if (thisIdx == otherIdx)
             {
                 compare.IsEqual().Should().BeTrue();
                 compare.IsLesser().Should().BeFalse();
                 compare.IsGreater().Should().BeFalse();
             }
             if (thisIdx < otherIdx)
             {
                 compare.IsEqual().Should().BeFalse();
                 compare.IsLesser().Should().BeTrue();
                 compare.IsGreater().Should().BeFalse();
             }
             if (thisIdx > otherIdx)
             {
                 compare.IsEqual().Should().BeFalse();
                 compare.IsLesser().Should().BeFalse();
                 compare.IsGreater().Should().BeTrue();
             }
         }
     }
 }
 public PointersSearchStrategy(IValueCompare <PossiblePointerInfo> valueComparer, bool checkVmt = false, bool firstFound = false) : base(8,
                                                                                                                                         firstFound)
 {
     _valueComparer = valueComparer;
     _checkVMT      = checkVmt;
 }
 public IntValueReader(IValueCompare <int> valueCompare)
 {
     _valueCompare = valueCompare;
 }
 public ValueReaderStrategy(IValueCompare <ValueReaderData> valueCompare, int alignment, bool firstFound = false) : base(alignment, firstFound)
 {
     _valueCompare = valueCompare;
 }
 public PointerValueCompare(IValueCompare <long> valueCompare)
 {
     _valueCompare = valueCompare;
 }
 public NegateValueCompare(IValueCompare origin) => _origin = origin;
 public FloatValueReader(IValueCompare <float> valueCompare)
 {
     _valueCompare = valueCompare;
 }
Beispiel #8
0
 public ByteValueReader(IValueCompare <byte> valueCompare)
 {
     _valueCompare = valueCompare;
 }
 public StringValueReader(IValueCompare <string> compareValue)
 {
     _compareValue = compareValue;
 }
 public static IOffsetSearch StringSearch(IValueCompare <string> comparer, bool firstFound = false)
 {
     return(new PointersSearchStrategy(new StringValueReader(comparer), checkVmt: false, firstFound: firstFound));
 }
        private readonly IValueCompare <int> _arrayLengthCompare; //this can be used as range compare (not only const value)

        public ArrayLengthDoublePointerCompare(IValueCompare <int> arrayLengthCompare)
        {
            _arrayLengthCompare = arrayLengthCompare;
        }
Beispiel #12
0
 public UShortValueReader(IValueCompare <ushort> valueCompare)
 {
     _valueCompare = valueCompare;
 }