#include <assert.h>
#include <stdio.h>
#include <limits.h>
+#include <isl_ctx_private.h>
#include <isl_map_private.h>
-#include <isl/ctx.h>
#include <isl/set.h>
#include <isl/flow.h>
#include <isl/constraint.h>
isl_map_free(map);
}
+void test_parse_map_equal(isl_ctx *ctx, const char *str, const char *str2)
+{
+ isl_map *map, *map2;
+
+ map = isl_map_read_from_str(ctx, str, -1);
+ map2 = isl_map_read_from_str(ctx, str2, -1);
+ assert(map && map2 && isl_map_is_equal(map, map2));
+ isl_map_free(map);
+ isl_map_free(map2);
+}
+
void test_parse_pwqp(isl_ctx *ctx, const char *str)
{
isl_pw_qpolynomial *pwqp;
void test_parse(struct isl_ctx *ctx)
{
isl_map *map, *map2;
- const char *str;
+ const char *str, *str2;
str = "{ [i] -> [-i] }";
map = isl_map_read_from_str(ctx, str, -1);
test_parse_map(ctx, "{ [p1, y1, y2] -> [2, y1, y2] : "
"p1 = 1 && (y1 <= y2 || y2 = 0) }");
+ str = "{ [x,y] : [([x/2]+y)/3] >= 1 }";
+ str2 = "{ [x, y] : 2y >= 6 - x }";
+ test_parse_map_equal(ctx, str, str2);
+
+ test_parse_map_equal(ctx, "{ [x,y] : x <= min(y, 2*y+3) }",
+ "{ [x,y] : x <= y, 2*y + 3 }");
+ str = "{ [x, y] : (y <= x and y >= -3) or (2y <= -3 + x and y <= -4) }";
+ test_parse_map_equal(ctx, "{ [x,y] : x >= min(y, 2*y+3) }", str);
+
str = "{[new,old] -> [new+1-2*[(new+1)/2],old+1-2*[(old+1)/2]]}";
map = isl_map_read_from_str(ctx, str, -1);
str = "{ [new, old] -> [o0, o1] : "
isl_map_free(map);
isl_map_free(map2);
+ str = "[n] -> { [c1] : c1>=0 and c1<=floord(n-4,3) }";
+ str2 = "[n] -> { [c1] : c1 >= 0 and 3c1 <= -4 + n }";
+ test_parse_map_equal(ctx, str, str2);
+
test_parse_pwqp(ctx, "{ [i] -> i + [ (i + [i/3])/2 ] }");
+ test_parse_map(ctx, "{ S1[i] -> [([i/10]),i%10] : 0 <= i <= 45 }");
}
void test_read(struct isl_ctx *ctx)