add gist test
authorSven Verdoolaege <skimo@kotnet.org>
Thu, 20 Nov 2008 16:09:20 +0000 (17:09 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 2 Dec 2008 19:35:48 +0000 (20:35 +0100)
include/isl_set.h
isl_map.c
isl_test.c
test_inputs/gist1.polylib [new file with mode: 0644]

index 0bc5eb6..245cc51 100644 (file)
@@ -174,6 +174,8 @@ int isl_set_fast_dim_is_fixed(struct isl_set *set, unsigned dim, isl_int *val);
 int isl_set_fast_dim_has_fixed_lower_bound(struct isl_set *set,
        unsigned dim, isl_int *val);
 
+struct isl_basic_set *isl_basic_set_gist(struct isl_basic_set *bset,
+                                               struct isl_basic_set *context);
 struct isl_set *isl_set_gist(struct isl_set *set,
        struct isl_basic_set *context);
 int isl_basic_set_dim_residue_class(struct isl_basic_set *bset,
index ab147b8..21a071d 100644 (file)
--- a/isl_map.c
+++ b/isl_map.c
@@ -4470,6 +4470,13 @@ error:
        return NULL;
 }
 
+struct isl_basic_set *isl_basic_set_gist(struct isl_basic_set *bset,
+                                               struct isl_basic_set *context)
+{
+       return (struct isl_basic_set *)isl_basic_map_gist(
+               (struct isl_basic_map *)bset, (struct isl_basic_map *)context);
+}
+
 struct isl_set *isl_set_gist(struct isl_set *set, struct isl_basic_set *context)
 {
        return (struct isl_set *)isl_map_gist((struct isl_map *)set,
index 33c891f..07d4de8 100644 (file)
@@ -119,6 +119,40 @@ void test_convex_hull(struct isl_ctx *ctx)
        test_convex_hull_case(ctx, "convex11");
 }
 
+void test_gist_case(struct isl_ctx *ctx, const char *name)
+{
+       char filename[PATH_MAX];
+       FILE *input;
+       int n;
+       struct isl_basic_set *bset1, *bset2;
+       struct isl_set *set;
+
+       n = snprintf(filename, sizeof(filename),
+                       "%s/test_inputs/%s.polylib", srcdir, name);
+       assert(n < sizeof(filename));
+       input = fopen(filename, "r");
+       assert(input);
+
+       bset1 = isl_basic_set_read_from_file(ctx, input, 0, ISL_FORMAT_POLYLIB);
+       bset2 = isl_basic_set_read_from_file(ctx, input, 0, ISL_FORMAT_POLYLIB);
+
+       bset1 = isl_basic_set_gist(bset1, bset2);
+
+       bset2 = isl_basic_set_read_from_file(ctx, input, 0, ISL_FORMAT_POLYLIB);
+
+       assert(isl_basic_set_is_equal(bset1, bset2) == 1);
+
+       isl_basic_set_free(bset1);
+       isl_basic_set_free(bset2);
+
+       fclose(input);
+}
+
+void test_gist(struct isl_ctx *ctx)
+{
+       test_gist_case(ctx, "gist1");
+}
+
 int main()
 {
        struct isl_ctx *ctx;
@@ -129,6 +163,7 @@ int main()
        test_application(ctx);
        test_affine_hull(ctx);
        test_convex_hull(ctx);
+       test_gist(ctx);
        isl_ctx_free(ctx);
        return 0;
 }
diff --git a/test_inputs/gist1.polylib b/test_inputs/gist1.polylib
new file mode 100644 (file)
index 0000000..802a4eb
--- /dev/null
@@ -0,0 +1,14 @@
+4 5
+0 1 0 0 -1
+0 0 1 0 1
+0 0 0 1 -3
+1 0 0 0 1
+
+4 5
+0 1 0 0 -1
+0 0 1 1 -2
+1 0 0 1 0
+1 0 0 -1 3
+
+1 5
+0 0 1 0 1