add trivial affine hull test
authorSven Verdoolaege <skimo@kotnet.org>
Sun, 17 Aug 2008 14:33:02 +0000 (16:33 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 25 Aug 2008 08:15:08 +0000 (10:15 +0200)
isl_test.c
test_inputs/affine.polylib [new file with mode: 0644]

index c5fdd92..5616892 100644 (file)
@@ -6,6 +6,32 @@
 
 static char *srcdir;
 
+void test_affine_hull(struct isl_ctx *ctx)
+{
+       char filename[PATH_MAX];
+       FILE *input;
+       int n;
+       struct isl_basic_set *bset1, *bset2;
+
+       n = snprintf(filename, sizeof(filename),
+                       "%s/test_inputs/affine.polylib", srcdir);
+       assert(n < sizeof(filename));
+       input = fopen(filename, "r");
+       assert(input);
+
+       bset1 = isl_basic_set_read_from_file(ctx, input, ISL_FORMAT_POLYLIB);
+       bset2 = isl_basic_set_read_from_file(ctx, input, ISL_FORMAT_POLYLIB);
+
+       bset1 = isl_basic_set_affine_hull(ctx, bset1);
+
+       assert(isl_basic_set_is_equal(ctx, bset1, bset2) == 1);
+
+       isl_basic_set_free(ctx, bset1);
+       isl_basic_set_free(ctx, bset2);
+
+       fclose(input);
+}
+
 void test_convex_hull_case(struct isl_ctx *ctx, const char *name)
 {
        char filename[PATH_MAX];
@@ -55,6 +81,7 @@ int main()
        srcdir = getenv("srcdir");
 
        ctx = isl_ctx_alloc();
+       test_affine_hull(ctx);
        test_convex_hull(ctx);
        isl_ctx_free(ctx);
        return 0;
diff --git a/test_inputs/affine.polylib b/test_inputs/affine.polylib
new file mode 100644 (file)
index 0000000..f14720c
--- /dev/null
@@ -0,0 +1,9 @@
+# the affine hull of {[a,b] : a=b && 1 <= a <= 163} ...
+3 4
+0 1 -1 0
+1 1  0 -1
+1 -1 0 163
+
+# ... is {[a,b] : a=b} (and not {[In_1,In_2]}, as Omega 1.2 claims)
+1 4
+0 1 -1 0