public void CachedHashCodeIdentifierExpr() { var id = new IdentifierExpr(Token.NoToken, "foo", BasicType.Bool, /*immutable=*/true); Assert.AreEqual(id.ComputeHashCode(), id.GetHashCode()); var variable = new BoundVariable(Token.NoToken, new TypedIdent(Token.NoToken, "foo2", BasicType.Int)); var id2 = new IdentifierExpr(Token.NoToken, variable, /*immutable=*/true); Assert.AreEqual(id2.ComputeHashCode(), id2.GetHashCode()); }
public void CachedHashCodeIdentifierExpr() { var id = new IdentifierExpr(Token.NoToken, "foo", BasicType.Bool, /*immutable=*/true); Assert.AreEqual(id.ComputeHashCode(), id.GetHashCode()); var variable = new BoundVariable(Token.NoToken, new TypedIdent(Token.NoToken, "foo2", BasicType.Int)); var id2 = new IdentifierExpr(Token.NoToken, variable, /*immutable=*/true); Assert.AreEqual(id2.ComputeHashCode(), id2.GetHashCode()); }
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 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 }