return test_special_schedule(ctx);
}
+int test_plain_injective(isl_ctx *ctx, const char *str, int injective)
+{
+ isl_union_map *umap;
+ int test;
+
+ umap = isl_union_map_read_from_str(ctx, str);
+ test = isl_union_map_plain_is_injective(umap);
+ isl_union_map_free(umap);
+ if (test < 0)
+ return -1;
+ if (test == injective)
+ return 0;
+ if (injective)
+ isl_die(ctx, isl_error_unknown,
+ "map not detected as injective", return -1);
+ else
+ isl_die(ctx, isl_error_unknown,
+ "map detected as injective", return -1);
+}
+
+int test_injective(isl_ctx *ctx)
+{
+ const char *str;
+
+ if (test_plain_injective(ctx, "{S[i,j] -> A[0]; T[i,j] -> B[1]}", 0))
+ return -1;
+ if (test_plain_injective(ctx, "{S[] -> A[0]; T[] -> B[0]}", 1))
+ return -1;
+ if (test_plain_injective(ctx, "{S[] -> A[0]; T[] -> A[1]}", 1))
+ return -1;
+ if (test_plain_injective(ctx, "{S[] -> A[0]; T[] -> A[0]}", 0))
+ return -1;
+ if (test_plain_injective(ctx, "{S[i] -> A[i,0]; T[i] -> A[i,1]}", 1))
+ return -1;
+ if (test_plain_injective(ctx, "{S[i] -> A[i]; T[i] -> A[i]}", 0))
+ return -1;
+ if (test_plain_injective(ctx, "{S[] -> A[0,0]; T[] -> A[0,1]}", 1))
+ return -1;
+ if (test_plain_injective(ctx, "{S[] -> A[0,0]; T[] -> A[1,0]}", 1))
+ return -1;
+
+ str = "{S[] -> A[0,0]; T[] -> A[0,1]; U[] -> A[1,0]}";
+ if (test_plain_injective(ctx, str, 1))
+ return -1;
+ str = "{S[] -> A[0,0]; T[] -> A[0,1]; U[] -> A[0,0]}";
+ if (test_plain_injective(ctx, str, 0))
+ return -1;
+
+ return 0;
+}
+
int main()
{
struct isl_ctx *ctx;
assert(srcdir);
ctx = isl_ctx_alloc();
+ if (test_injective(ctx) < 0)
+ goto error;
if (test_schedule(ctx) < 0)
goto error;
test_factorize(ctx);