예제 #1
0
 public override bool Match(TOperand operand)
 {
     return(IntRange.Contains(ConvertOperand(operand)));
 }
예제 #2
0
 public override bool Match(int operand)
 {
     return(IntRange.Contains(operand));
 }
예제 #3
0
        public void Contains()
        {
            IntRange range = new IntRange(3, 8);

            Assert.IsFalse(range.Contains(0));
            Assert.IsFalse(range.Contains(1));
            Assert.IsFalse(range.Contains(9));
            Assert.IsTrue(range.Contains(3));
            Assert.IsTrue(range.Contains(5));
            Assert.IsTrue(range.Contains(8));

            range.minimum = 4;
            range.maximum = 7;

            Assert.IsFalse(range.Contains(1));
            Assert.IsFalse(range.Contains(3));
            Assert.IsFalse(range.Contains(8));
            Assert.IsTrue(range.Contains(4));
            Assert.IsTrue(range.Contains(5));
            Assert.IsTrue(range.Contains(6));

            range.minimum = 7;
            range.maximum = 4;

            Assert.IsFalse(range.Contains(4));
            Assert.IsFalse(range.Contains(5));
            Assert.IsFalse(range.Contains(6));

            range.minimum = -7;
            range.maximum = -3;

            Assert.IsTrue(range.Contains(-4));
            Assert.IsTrue(range.Contains(-4));
            Assert.IsTrue(range.Contains(-5));
            Assert.IsFalse(range.Contains(-1));
            Assert.IsFalse(range.Contains(-8));
            Assert.IsFalse(range.Contains(1));
        }