public void TestEquals() { for (int i = 0; i < _values.Length; i++) { for (int j = 0; j < _values.Length; j++) { SimpleType thisType = (SimpleType)_values[i][0]; SimpleType otherType = (SimpleType)_values[j][0]; if (i != j) { Assert.IsFalse(thisType.Equals(otherType)); } else { Assert.IsTrue(thisType.Equals(otherType)); } } } }
private MiniPascalType ReadType() { if (Accept(Symbol.Array)) { Require(Symbol.IndexOpen); IExpression intLiteral = ReadExpression(); Require(Symbol.IndexClose); Require(Symbol.Of); SimpleType type = ReadSimpleType(); if (type == null) { throw new SyntaxException(expType, current); } return(new MiniPascalType(type, intLiteral)); } SimpleType simple = ReadSimpleType(); if (simple != null) { if (simple.Equals(SimpleType.Integer)) { return(MiniPascalType.Integer); } else if (simple.Equals(SimpleType.Boolean)) { return(MiniPascalType.Boolean); } else if (simple.Equals(SimpleType.Real)) { return(MiniPascalType.Real); } else if (simple.Equals(SimpleType.String)) { return(MiniPascalType.String); } } return(null); }