isl_qpolynomial_reset_domain_space: fix memory management annotation
[isl.git] / check_parse_fail_test_templ.c
blob6fba085ea3813e0768d8a07f09d9172d4e192d87
1 /*
2 * Copyright 2021 Cerebras Systems
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Cerebras Systems, 1237 E Arques Ave, Sunnyvale, CA, USA
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 #undef TESTS
18 #define TESTS CAT(parse_,CAT(BASE,_fail_tests))
20 /* Test parsing of objects of type TYPE
21 * that are expected to fail.
23 static isl_stat FN(check,TESTS)(isl_ctx *ctx)
25 int i, n;
26 int on_error;
28 on_error = isl_options_get_on_error(ctx);
29 isl_options_set_on_error(ctx, ISL_ON_ERROR_CONTINUE);
30 n = ARRAY_SIZE(TESTS);
31 for (i = 0; i < n; ++i) {
32 TYPE *obj;
34 obj = FN(TYPE,read_from_str)(ctx, TESTS[i]);
35 FN(TYPE,free)(obj);
36 if (obj)
37 break;
39 isl_options_set_on_error(ctx, on_error);
40 if (i < n)
41 isl_die(ctx, isl_error_unknown,
42 "parsing not expected to succeed",
43 return isl_stat_error);
45 return isl_stat_ok;