X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_test.c;h=cf4fafbae6ba662fad131a7bff944c74cf5034dd;hb=e173fc6f8e101dd2f97e3c8eed4590e451cd89c1;hp=d8248a347b10aeab1309c03e81b0040f7c923315;hpb=b76378b173ff6a7dbbcaea5794a8b6a07a23fcb4;p=platform%2Fupstream%2Fisl.git diff --git a/isl_test.c b/isl_test.c index d8248a3..cf4fafb 100644 --- a/isl_test.c +++ b/isl_test.c @@ -2337,6 +2337,90 @@ int test_dim_max(isl_ctx *ctx) return 0; } +int test_product(isl_ctx *ctx) +{ + const char *str; + isl_set *set; + int ok; + + str = "{ A[i] }"; + set = isl_set_read_from_str(ctx, str, -1); + set = isl_set_product(set, isl_set_copy(set)); + ok = isl_set_is_wrapping(set); + isl_set_free(set); + if (ok < 0) + return -1; + if (!ok) + isl_die(ctx, isl_error_unknown, "unexpected result", return -1); + + return 0; +} + +int test_equal(isl_ctx *ctx) +{ + const char *str; + isl_set *set, *set2; + int equal; + + str = "{ S_6[i] }"; + set = isl_set_read_from_str(ctx, str, -1); + str = "{ S_7[i] }"; + set2 = isl_set_read_from_str(ctx, str, -1); + equal = isl_set_is_equal(set, set2); + isl_set_free(set); + isl_set_free(set2); + if (equal < 0) + return -1; + if (equal) + isl_die(ctx, isl_error_unknown, "unexpected result", return -1); + + return 0; +} + +static int test_plain_fixed(isl_ctx *ctx, __isl_take isl_map *map, + enum isl_dim_type type, unsigned pos, int fixed) +{ + int test; + + test = isl_map_plain_is_fixed(map, type, pos, NULL); + isl_map_free(map); + if (test < 0) + return -1; + if (test == fixed) + return 0; + if (fixed) + isl_die(ctx, isl_error_unknown, + "map not detected as fixed", return -1); + else + isl_die(ctx, isl_error_unknown, + "map detected as fixed", return -1); +} + +int test_fixed(isl_ctx *ctx) +{ + const char *str; + isl_map *map; + + str = "{ [i] -> [i] }"; + map = isl_map_read_from_str(ctx, str, -1); + if (test_plain_fixed(ctx, map, isl_dim_out, 0, 0)) + return -1; + str = "{ [i] -> [1] }"; + map = isl_map_read_from_str(ctx, str, -1); + if (test_plain_fixed(ctx, map, isl_dim_out, 0, 1)) + return -1; + str = "{ S_1[p1] -> [o0] : o0 = -2 and p1 >= 1 and p1 <= 7 }"; + map = isl_map_read_from_str(ctx, str, -1); + if (test_plain_fixed(ctx, map, isl_dim_out, 0, 1)) + return -1; + map = isl_map_read_from_str(ctx, str, -1); + map = isl_map_neg(map); + if (test_plain_fixed(ctx, map, isl_dim_out, 0, 1)) + return -1; + + return 0; +} + int main() { struct isl_ctx *ctx; @@ -2345,6 +2429,12 @@ int main() assert(srcdir); ctx = isl_ctx_alloc(); + if (test_fixed(ctx) < 0) + goto error; + if (test_equal(ctx) < 0) + goto error; + if (test_product(ctx) < 0) + goto error; if (test_dim_max(ctx) < 0) goto error; if (test_aff(ctx) < 0)