if (test_parse_map_equal(ctx, "{ [*] }", "{ [a] }") < 0)
return -1;
+ if (test_parse_map_equal(ctx, "{ [i] : 2*floor(i/2) = i }",
+ "{ [i] : exists a : i = 2 a }") < 0)
+ return -1;
+
+ if (test_parse_map_equal(ctx, "{ [a] -> [b] : a = 5 implies b = 5 }",
+ "{ [a] -> [b] : a != 5 or b = 5 }") < 0)
+ return -1;
+
return 0;
}
fclose(input);
}
-void test_gist(struct isl_ctx *ctx)
+static int test_gist(struct isl_ctx *ctx)
{
const char *str;
isl_basic_set *bset1, *bset2;
+ isl_map *map1, *map2;
test_gist_case(ctx, "gist1");
bset1 = isl_basic_set_gist(bset1, bset2);
assert(bset1 && bset1->n_div == 0);
isl_basic_set_free(bset1);
+
+ /* Check that the integer divisions of the second disjunct
+ * do not spread to the first disjunct.
+ */
+ str = "[t1] -> { S_0[] -> A[o0] : (exists (e0 = [(-t1 + o0)/16]: "
+ "16e0 = -t1 + o0 and o0 >= 0 and o0 <= 15 and t1 >= 0)) or "
+ "(exists (e0 = [(-1 + t1)/16], "
+ "e1 = [(-16 + t1 - 16e0)/4294967296]: "
+ "4294967296e1 = -16 + t1 - o0 - 16e0 and "
+ "16e0 <= -1 + t1 and 16e0 >= -16 + t1 and o0 >= 0 and "
+ "o0 <= 4294967295 and t1 <= -1)) }";
+ map1 = isl_map_read_from_str(ctx, str);
+ str = "[t1] -> { S_0[] -> A[o0] : t1 >= 0 and t1 <= 4294967295 }";
+ map2 = isl_map_read_from_str(ctx, str);
+ map1 = isl_map_gist(map1, map2);
+ if (!map1)
+ return -1;
+ if (map1->n != 1)
+ isl_die(ctx, isl_error_unknown, "expecting single disjunct",
+ isl_map_free(map1); return -1);
+ if (isl_basic_map_dim(map1->p[0], isl_dim_div) != 1)
+ isl_die(ctx, isl_error_unknown, "expecting single div",
+ isl_map_free(map1); return -1);
+ isl_map_free(map1);
+
+ return 0;
}
int test_coalesce_set(isl_ctx *ctx, const char *str, int check_one)
if (!equal)
isl_die(ctx, isl_error_unknown, "unexpected result", return -1);
+ str = "{ [a,b,c] -> (([(2*[a/3]+1)/5]) * ([(2*[c/3]+1)/5])) : b = 1 }";
+ pwqp2 = isl_pw_qpolynomial_read_from_str(ctx, str);
+ str = "{ [a,b,c] -> (([(2*[a/3]+b)/5]) * ([(2*[c/3]+b)/5])) }";
+ pwqp1 = isl_pw_qpolynomial_read_from_str(ctx, str);
+ pwqp1 = isl_pw_qpolynomial_fix_val(pwqp1, isl_dim_set, 1,
+ isl_val_one(ctx));
+ equal = isl_pw_qpolynomial_plain_is_equal(pwqp1, pwqp2);
+ isl_pw_qpolynomial_free(pwqp1);
+ isl_pw_qpolynomial_free(pwqp2);
+ if (equal < 0)
+ return -1;
+ if (!equal)
+ isl_die(ctx, isl_error_unknown, "unexpected result", return -1);
+
return 0;
}
{ "subset", &test_subset },
{ "subtract", &test_subtract },
{ "lexmin", &test_lexmin },
+ { "gist", &test_gist },
{ "piecewise quasi-polynomials", &test_pwqp },
};
test_dim(ctx);
test_application(ctx);
test_convex_hull(ctx);
- test_gist(ctx);
test_closure(ctx);
isl_ctx_free(ctx);
return 0;