isl_pw_*_gist{,_params}: do not pre-compute hull of context
[isl.git] / isl_test_plain_equal_templ.c
blob5acbf1e85450f1ac1c3865ed8c1d59e5a98bf3d2
1 /*
2 * Copyright 2012 Ecole Normale Superieure
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
8 */
10 #define xCAT(A,B) A ## B
11 #define CAT(A,B) xCAT(A,B)
12 #undef TYPE
13 #define TYPE CAT(isl_,BASE)
14 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
15 #define FN(TYPE,NAME) xFN(TYPE,NAME)
17 /* Is "obj" obviously equal to the object represented by "str"?
19 static isl_bool FN(BASE,plain_is_equal)(__isl_keep TYPE *obj, const char *str)
21 isl_ctx *ctx;
22 TYPE *obj2;
23 isl_bool equal;
25 if (!obj)
26 return isl_bool_error;
28 ctx = FN(TYPE,get_ctx)(obj);
29 obj2 = FN(TYPE,read_from_str)(ctx, str);
30 equal = FN(TYPE,plain_is_equal)(obj, obj2);
31 FN(TYPE,free)(obj2);
33 return equal;
36 /* Check that "obj" is obviously equal to the object represented by "str".
38 static isl_stat FN(BASE,check_plain_equal)(__isl_keep TYPE *obj,
39 const char *str)
41 isl_bool equal;
43 equal = FN(BASE,plain_is_equal)(obj, str);
44 if (equal < 0)
45 return isl_stat_error;
46 if (!equal)
47 isl_die(FN(TYPE,get_ctx)(obj), isl_error_unknown,
48 "result not as expected", return isl_stat_error);
49 return isl_stat_ok;