Beispiel #1
0
        public void BooleanType_ShouldImplement_ValueEquality()
        {
            var booleanType = new BooleanType();

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

            var result = Right.CheckType();

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

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

            return(TypeValidationResult.Valid(Type));
        }