void test_nans() { const char *nans[] = { "0/0", "1%0", "1%(1%0)", "(1%0)%1", }; int i; for (i = 0; i < sizeof(nans) / sizeof(const char *); ++i) { const char *expr = nans[i]; int err; const double r = te_interp(expr, &err); lequal(err, 0); lok(r != r); te_expr *n = te_compile(expr, 0, 0, &err); lok(n); lequal(err, 0); const double c = te_eval(n); lok(c != c); te_free(n); } }
void test_syntax() { test_case errors[] = { {"", 1}, {"1+", 2}, {"1)", 2}, {"(1", 2}, {"1**1", 3}, {"1*2(+4", 4}, {"1*2(1+4", 4}, {"a+5", 1}, {"A+5", 1}, {"Aa+5", 1}, {"1^^5", 3}, {"1**5", 3}, {"sin(cos5", 8}, }; int i; for (i = 0; i < sizeof(errors) / sizeof(test_case); ++i) { const char *expr = errors[i].expr; const int e = errors[i].answer; int err; const double r = te_interp(expr, &err); lequal(err, e); lok(r != r); te_expr *n = te_compile(expr, 0, 0, &err); lequal(err, e); lok(!n); if (err != e) { printf("FAILED: %s\n", expr); } const double k = te_interp(expr, 0); lok(k != k); } }
void aig_prop_baset::set_equal(literalt a, literalt b) { #ifdef USE_AIG_COMPACT // The compact encoding should reduce this l_set_to_true(lequal(a,b)); #else // we produce two constraints: // a|!b !a|b l_set_to_true(lor(pos(a), neg(b))); l_set_to_true(lor(neg(a), pos(b))); #endif }