3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-09 02:41:52 +00:00
z3/test/ast_pp.cpp
Leonardo de Moura 68269c43a6 other components
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-10-02 11:48:48 -07:00

60 lines
1.3 KiB
C++

/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
tst_ast_pp.cpp
Abstract:
Test AST Pretty printing module
Author:
Nikolaj Bjorner (nbjorner) 2006-10-5
Revision History:
--*/
#include "ast.h"
#include "ast_pp.h"
#include "ast_dag_pp.h"
#include "smtparser.h"
#include <iostream>
void tst_ast_pp()
{
ast_manager m;
smtlib::parser* parser = smtlib::parser::create(m);
parser->initialize_smtlib();
if (!parser->parse_string(
"(benchmark test :extrasorts (A B) :extrafuns ((f A A) (g A A A) (x A) (p A bool)) \n"
":formula (p (f x))\n"
":extrafuns ((x1 Int) (y1 Int))\n"
":formula (<= 1 (+ x1 y1))\n"
":formula (let (x (g x x)) (let (x (g x x)) (let (x (g x x)) (let (x (g x x)) (p (g x x))))))\n"
":formula (p x)\n"
")")) {
SASSERT(false);
dealloc(parser);
return;
}
smtlib::benchmark* b = parser->get_benchmark();
for (unsigned j = 0; j < b->get_num_assumptions(); ++j) {
expr* e = b->get_assumptions()[j];
std::cout << mk_pp(e, m) << "\n";
ast_dag_pp(std::cout, m, e);
}
for (unsigned j = 0; j < b->get_num_formulas(); ++j) {
expr* e = b->begin_formulas()[j];
std::cout << mk_pp(e, m) << "\n";
ast_dag_pp(std::cout, m, e);
}
dealloc(parser);
}