private void CheckType(Microsoft.Boogie.Type type, LiteralExpr theConstant, string expectedType, string expectedExpr) { string result = null; using (var stringWriter = new StringWriter()) { var printer = GetPrinter(stringWriter); var ts = CreateTypeSynonym(type, "mysn"); // Check we get the basic type back Assert.AreEqual(expectedType, SMTLIBQueryPrinter.GetSMTLIBType(ts)); // Now check it can be used in a query var typeIdent = new TypedIdent(Token.NoToken, "thetype", ts); var variable = new LocalVariable(Token.NoToken, typeIdent); // SymbolicVariable constructor requires that a ProgramLocation is already attached variable.SetMetadata((int)AnnotationIndex.PROGRAM_LOCATION, new ProgramLocation(variable)); var symbolic = new SymbolicVariable("symbolic_0", variable); var theExpr = Expr.Eq(symbolic.Expr, theConstant); printer.AddDeclarations(theExpr); printer.PrintExpr(theExpr); result = stringWriter.ToString(); } Assert.AreEqual(expectedExpr, result); }