Exemplo n.º 1
0
        public void FunctionType_ShouldImplement_ValueEquality()
        {
            var functionType = new FunctionType(new IntegerType(), new IntegerType(), new BooleanType());

            Assert.That(functionType.Equals(null), Is.False);
            Assert.That(functionType.Equals(new BooleanType()), Is.False);
            Assert.That(functionType.Equals(new FunctionType(new BooleanType(), new IntegerType(), new BooleanType())), Is.False);
            Assert.That(functionType.Equals(new FunctionType(new IntegerType(), new BooleanType(), new IntegerType())), Is.False);
            Assert.That(functionType.Equals(new FunctionType(new IntegerType(), new IntegerType(), new BooleanType())), Is.True);
        }
Exemplo n.º 2
0
        public void Equals()
        {
            var a = new FunctionType(new[] { ValueType.F32 }, new[] { ValueType.F64 });
            var b = new FunctionType(new[] { ValueType.F32 }, new[] { ValueType.F64 });

            Assert.That(a.Equals(a), Is.True);
            Assert.That(a.Equals(b), Is.True);
            Assert.That(a.Equals(null), Is.False);
            Assert.That(a.Equals((object)a), Is.True);
            Assert.That(a.Equals((object)b), Is.True);
            Assert.That(a.Equals((object)null), Is.False);
            Assert.That(a.GetHashCode(), Is.EqualTo(b.GetHashCode()));
            Assert.That(a == b, Is.True);
            Assert.That(a != b, Is.False);
        }
Exemplo n.º 3
0
        public bool Equals(Function function)
        {
            bool equivalence = _function_name.Equals(function._function_name);

            if (equivalence)
            {
                equivalence = this.Address.ToString().Equals(function.Address.ToString());
                if (equivalence)
                {
                    equivalence = _function_access_keyword.Equals(function._function_access_keyword);
                    if (equivalence)
                    {
                        equivalence = _function_type.Equals(function._function_type);
                        if (equivalence)
                        {
                            equivalence = MatchesParameters(this, function);
                            return(equivalence);
                        }
                    }
                }
            }
            return(false);
        }