public void SimpleIdentifierExprs() { var variable = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "foo", Microsoft.Boogie.Type.GetBvType(8))); var idVar = new IdentifierExpr(Token.NoToken, variable); var idVar2 = new IdentifierExpr(Token.NoToken, variable); Assert.AreNotSame(idVar, idVar2); // These are different references Assert.IsTrue(idVar.Equals(idVar2)); // These are "structurally equal" Assert.AreEqual(idVar.GetHashCode(), idVar2.GetHashCode()); // If the .Equals() is true then hash codes must be the same }
public void SimpleIdentifierVariables() { var variable = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "foo", Microsoft.Boogie.Type.GetBvType(8))); var variable2 = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, "foo", Microsoft.Boogie.Type.GetBvType(8))); var idVar = new IdentifierExpr(Token.NoToken, variable); var idVar2 = new IdentifierExpr(Token.NoToken, variable2); Assert.AreNotSame(idVar, idVar2); // These are different references // These are not "structurally equal" because the Variable references are different (even though they have the same name and type) Assert.IsFalse(idVar.Equals(idVar2)); }