xref: /netbsd-src/external/mit/isl/dist/check_reparse_test_templ.c (revision 5971e316fdea024efff6be8f03536623db06833e)
1 #define xCAT(A,B) A ## B
2 #define CAT(A,B) xCAT(A,B)
3 #undef TYPE
4 #define TYPE CAT(isl_,BASE)
5 #define xFN(TYPE,NAME) TYPE ## _ ## NAME
6 #define FN(TYPE,NAME) xFN(TYPE,NAME)
7 
8 #undef TESTS
9 #define TESTS CAT(reparse_,CAT(BASE,_tests))
10 
11 /* Test parsing of objects of type TYPE by printing
12  * the expressions and checking that parsing the output results
13  * in the same expression.
14  * Do this for a set of expressions parsed from strings.
15  */
FN(check,TESTS)16 static isl_stat FN(check,TESTS)(isl_ctx *ctx)
17 {
18 	int i;
19 
20 	for (i = 0; i < ARRAY_SIZE(TESTS); ++i) {
21 		TYPE *obj;
22 
23 		obj = FN(TYPE,read_from_str)(ctx, TESTS[i]);
24 		if (FN(check_reparse,BASE)(ctx, obj) < 0)
25 			return isl_stat_error;
26 	}
27 
28 	return isl_stat_ok;
29 }
30