示例#1
0
        public void IntegerType_ShouldImplement_ValueEquality()
        {
            var integerType = new IntegerType();

            Assert.That(integerType.Equals(null), Is.False);
            Assert.That(integerType.Equals(new BooleanType()), Is.False);
            Assert.That(integerType.Equals(new IntegerType()), Is.True);
        }
示例#2
0
        public override TypeValidationResult CheckType()
        {
            Type = new IntegerType();

            var result = Right.CheckType();

            if (result.HasError)
            {
                return(result);
            }

            if (Type.Equals(result.Type) == false)
            {
                return(TypeValidationResult.Invalid(Position, $"Negate operator called with expression which is not integer"));
            }

            return(TypeValidationResult.Valid(Type));
        }