mirror of
https://github.com/Z3Prover/z3
synced 2025-06-21 21:33:39 +00:00
Tabs, formatting.
This commit is contained in:
parent
8871cb120a
commit
00651f8f21
63 changed files with 715 additions and 717 deletions
|
@ -27,36 +27,36 @@ static void tst1() {
|
|||
unsigned n = rand()%10000;
|
||||
for (unsigned i = 0; i < n; i++) {
|
||||
int op = rand()%6;
|
||||
if (op <= 1) {
|
||||
bool val = (rand()%2) != 0;
|
||||
v1.push_back(val);
|
||||
v2.push_back(val);
|
||||
ENSURE(v1.size() == v2.size());
|
||||
}
|
||||
else if (op <= 3) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
if (v1.size() > 0) {
|
||||
bool val = (rand()%2) != 0;
|
||||
unsigned idx = rand()%v1.size();
|
||||
ENSURE(v1.get(idx) == v2[idx]);
|
||||
v1.set(idx, val);
|
||||
v2[idx] = val;
|
||||
ENSURE(v1.get(idx) == v2[idx]);
|
||||
}
|
||||
}
|
||||
else if (op <= 4) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
if (v1.size() > 0) {
|
||||
unsigned idx = rand()%v1.size();
|
||||
VERIFY(v1.get(idx) == v2[idx]);
|
||||
}
|
||||
}
|
||||
else if (op <= 5) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
for (unsigned j = 0; j < v1.size(); j++) {
|
||||
ENSURE(v1.get(j) == v2[j]);
|
||||
}
|
||||
}
|
||||
if (op <= 1) {
|
||||
bool val = (rand()%2) != 0;
|
||||
v1.push_back(val);
|
||||
v2.push_back(val);
|
||||
ENSURE(v1.size() == v2.size());
|
||||
}
|
||||
else if (op <= 3) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
if (v1.size() > 0) {
|
||||
bool val = (rand()%2) != 0;
|
||||
unsigned idx = rand()%v1.size();
|
||||
ENSURE(v1.get(idx) == v2[idx]);
|
||||
v1.set(idx, val);
|
||||
v2[idx] = val;
|
||||
ENSURE(v1.get(idx) == v2[idx]);
|
||||
}
|
||||
}
|
||||
else if (op <= 4) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
if (v1.size() > 0) {
|
||||
unsigned idx = rand()%v1.size();
|
||||
VERIFY(v1.get(idx) == v2[idx]);
|
||||
}
|
||||
}
|
||||
else if (op <= 5) {
|
||||
ENSURE(v1.size() == v2.size());
|
||||
for (unsigned j = 0; j < v1.size(); j++) {
|
||||
ENSURE(v1.get(j) == v2[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,6 +309,6 @@ void tst_bit_vector() {
|
|||
tst2();
|
||||
for (unsigned i = 0; i < 20; i++) {
|
||||
std::cerr << i << std::endl;
|
||||
tst1();
|
||||
tst1();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ template class dl_graph<diff_logic_ext>;
|
|||
typedef dl_graph<diff_logic_ext> dlg;
|
||||
|
||||
struct tst_dl_functor {
|
||||
smt::literal_vector m_literals;
|
||||
smt::literal_vector m_literals;
|
||||
void operator()(smt::literal l) {
|
||||
m_literals.push_back(l);
|
||||
}
|
||||
|
|
|
@ -98,8 +98,8 @@ void tst_expr_rand(char** argv, int argc, int& i) {
|
|||
i += 1;
|
||||
if (i + 1 < argc && 0 == strncmp(argv[i+1],"/rs:",3)) {
|
||||
rand_seed = atol(argv[i+1]+4);
|
||||
std::cout << "random seed:" << rand_seed << "\n";
|
||||
i += 1;
|
||||
std::cout << "random seed:" << rand_seed << "\n";
|
||||
i += 1;
|
||||
}
|
||||
|
||||
if (i + 1 < argc && 0 == strcmp(argv[i+1],"/arith")) {
|
||||
|
|
|
@ -16,20 +16,20 @@
|
|||
// and print "PASS" to indicate success.
|
||||
//
|
||||
|
||||
#define TST(MODULE) { \
|
||||
std::string s("test "); \
|
||||
s += #MODULE; \
|
||||
void tst_##MODULE(); \
|
||||
#define TST(MODULE) { \
|
||||
std::string s("test "); \
|
||||
s += #MODULE; \
|
||||
void tst_##MODULE(); \
|
||||
if (do_display_usage) \
|
||||
std::cout << #MODULE << "\n"; \
|
||||
for (int i = 0; i < argc; i++) \
|
||||
if (test_all || strcmp(argv[i], #MODULE) == 0) { \
|
||||
for (int i = 0; i < argc; i++) \
|
||||
if (test_all || strcmp(argv[i], #MODULE) == 0) { \
|
||||
enable_trace(#MODULE); \
|
||||
enable_debug(#MODULE); \
|
||||
timeit timeit(true, s.c_str()); \
|
||||
tst_##MODULE(); \
|
||||
enable_debug(#MODULE); \
|
||||
timeit timeit(true, s.c_str()); \
|
||||
tst_##MODULE(); \
|
||||
std::cout << "PASS" << std::endl; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define TST_ARGV(MODULE) { \
|
||||
|
@ -39,13 +39,13 @@
|
|||
if (do_display_usage) \
|
||||
std::cout << #MODULE << "\n"; \
|
||||
for (int i = 0; i < argc; i++) \
|
||||
if (strcmp(argv[i], #MODULE) == 0) { \
|
||||
if (strcmp(argv[i], #MODULE) == 0) { \
|
||||
enable_trace(#MODULE); \
|
||||
enable_debug(#MODULE); \
|
||||
timeit timeit(true, s.c_str()); \
|
||||
tst_##MODULE(argv, argc, i); \
|
||||
enable_debug(#MODULE); \
|
||||
timeit timeit(true, s.c_str()); \
|
||||
tst_##MODULE(argv, argc, i); \
|
||||
std::cout << "PASS" << std::endl; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
void error(const char * msg) {
|
||||
|
@ -76,49 +76,49 @@ void display_usage() {
|
|||
void parse_cmd_line_args(int argc, char ** argv, bool& do_display_usage, bool& test_all) {
|
||||
int i = 1;
|
||||
while (i < argc) {
|
||||
char * arg = argv[i], *eq_pos = 0;
|
||||
char * arg = argv[i], *eq_pos = 0;
|
||||
|
||||
if (arg[0] == '-' || arg[0] == '/') {
|
||||
char * opt_name = arg + 1;
|
||||
char * opt_arg = 0;
|
||||
char * colon = strchr(arg, ':');
|
||||
if (colon) {
|
||||
opt_arg = colon + 1;
|
||||
*colon = 0;
|
||||
}
|
||||
if (strcmp(opt_name, "h") == 0 ||
|
||||
if (arg[0] == '-' || arg[0] == '/') {
|
||||
char * opt_name = arg + 1;
|
||||
char * opt_arg = 0;
|
||||
char * colon = strchr(arg, ':');
|
||||
if (colon) {
|
||||
opt_arg = colon + 1;
|
||||
*colon = 0;
|
||||
}
|
||||
if (strcmp(opt_name, "h") == 0 ||
|
||||
strcmp(opt_name, "?") == 0) {
|
||||
display_usage();
|
||||
display_usage();
|
||||
do_display_usage = true;
|
||||
return;
|
||||
}
|
||||
else if (strcmp(opt_name, "v") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/v:level) is missing.");
|
||||
long lvl = strtol(opt_arg, 0, 10);
|
||||
set_verbosity_level(lvl);
|
||||
}
|
||||
else if (strcmp(opt_name, "w") == 0) {
|
||||
}
|
||||
else if (strcmp(opt_name, "v") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/v:level) is missing.");
|
||||
long lvl = strtol(opt_arg, 0, 10);
|
||||
set_verbosity_level(lvl);
|
||||
}
|
||||
else if (strcmp(opt_name, "w") == 0) {
|
||||
enable_warning_messages(true);
|
||||
}
|
||||
else if (strcmp(opt_name, "a") == 0) {
|
||||
}
|
||||
else if (strcmp(opt_name, "a") == 0) {
|
||||
test_all = true;
|
||||
}
|
||||
}
|
||||
#ifdef _TRACE
|
||||
else if (strcmp(opt_name, "tr") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/tr:tag) is missing.");
|
||||
enable_trace(opt_arg);
|
||||
}
|
||||
else if (strcmp(opt_name, "tr") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/tr:tag) is missing.");
|
||||
enable_trace(opt_arg);
|
||||
}
|
||||
#endif
|
||||
#ifdef Z3DEBUG
|
||||
else if (strcmp(opt_name, "dbg") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/dbg:tag) is missing.");
|
||||
enable_debug(opt_arg);
|
||||
}
|
||||
else if (strcmp(opt_name, "dbg") == 0) {
|
||||
if (!opt_arg)
|
||||
error("option argument (/dbg:tag) is missing.");
|
||||
enable_debug(opt_arg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (arg[0] != '"' && (eq_pos = strchr(arg, '='))) {
|
||||
char * key = arg;
|
||||
*eq_pos = 0;
|
||||
|
@ -130,7 +130,7 @@ void parse_cmd_line_args(int argc, char ** argv, bool& do_display_usage, bool& t
|
|||
std::cerr << ex.msg() << "\n";
|
||||
}
|
||||
}
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ static void add_random_ineq(opt::model_based_opt& mbo,
|
|||
continue;
|
||||
}
|
||||
unsigned sign = r(2);
|
||||
coeff = sign == 0 ? coeff : -coeff;
|
||||
coeff = sign == 0 ? coeff : -coeff;
|
||||
vars.push_back(var(x, rational(coeff)));
|
||||
value += coeff*values[x];
|
||||
}
|
||||
|
|
|
@ -36,11 +36,11 @@ struct OptFoo {
|
|||
int m_y;
|
||||
|
||||
OptFoo(int x, int y):m_x(x), m_y(y) {
|
||||
TRACE("optional", tout << "OptFoo created: " << m_x << " : " << m_y << "\n";);
|
||||
TRACE("optional", tout << "OptFoo created: " << m_x << " : " << m_y << "\n";);
|
||||
}
|
||||
|
||||
~OptFoo() {
|
||||
TRACE("optional", tout << "OptFoo deleted: " << m_x << " : " << m_y << "\n";);
|
||||
TRACE("optional", tout << "OptFoo deleted: " << m_x << " : " << m_y << "\n";);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue