update pet to version 0.11.6
[ppn.git] / tests / pn2adg.cc
blob52ea26b34188ecc15efe804e5c9bb65aadc10e80
1 #include <limits.h>
2 #include <isa/adg.h>
3 #include "adg_parse.h"
4 #include "testlib.h"
6 adg *load_adg(isl_ctx *ctx, const char *base)
8 char path[PATH_MAX];
9 char *srcdir;
10 int n;
11 FILE *in;
12 adg *adg;
14 srcdir = getenv("srcdir");
15 assert(srcdir);
16 n = snprintf(path, sizeof(path), "%s/inputs/%s_pn_adg.yaml",
17 srcdir, base);
18 assert(n < sizeof(path));
19 in = fopen(path, "r");
20 assert(in);
22 adg = adg_parse(ctx, in);
23 assert(adg);
24 fclose(in);
26 return adg;
29 static void check(isl_ctx *ctx, const char *base)
31 adg *adg1, *adg2;
33 fprintf(stdout, "%s\n", base);
35 construct_pdg(base);
36 construct_pn(base);
37 adg1 = get_adg(ctx, base);
38 adg2 = load_adg(ctx, base);
39 assert(adg1);
40 assert(adg2);
41 isl_id_free(adg1->name);
42 adg1->name = isl_id_copy(adg2->name);
43 assert(adg1->is_equal(adg2));
44 delete adg1;
45 delete adg2;
47 construct_adg(base, "--xml");
50 int main(int argc, char *argv[])
52 isl_ctx *ctx;
54 ctx = isl_ctx_alloc();
56 check(ctx, "disconnected");
57 check(ctx, "wdp");
58 check(ctx, "multi_assignment");
59 check(ctx, "multi_reuse");
60 check(ctx, "odd_even");
61 check(ctx, "test_mod");
62 check(ctx, "union");
63 check(ctx, "wire2");
64 check(ctx, "wlan_dec");
65 check(ctx, "lsod");
67 isl_ctx_free(ctx);
69 return 0;