update pet to version 0.11.6
[ppn.git] / tests / pn.cc
bloba5bef2862d3f413b0a2b2f8257f25d83fc907150
1 #include <assert.h>
2 #include "testlib.h"
4 using pdg::PDG;
6 int main(int argc, char *argv[])
8 isl_ctx *ctx = isl_ctx_alloc();
9 construct_pdg("QR");
10 PDG *pdg = get_pn(ctx, "QR");
12 assert(pdg->nodes.size() == 5);
13 assert(pdg->dependences.size() == 12);
14 for (int i = 0; i < pdg->dependences.size(); ++i) {
15 pdg::dependence *dep = pdg->dependences[i];
16 assert(!dep->reordering);
17 assert(!dep->multiplicity);
20 pdg->free();
21 delete pdg;
23 construct_pdg("sobel");
24 pdg = get_pn(ctx, "sobel");
26 int n_shift = 0;
27 assert(pdg->dependences.size() == 5);
28 for (int i = 0; i < pdg->dependences.size(); ++i) {
29 pdg::dependence *dep = pdg->dependences[i];
30 assert(dep->value_size->v > 0);
31 if (pdg->dependences[i]->type == pdg::dependence::pn_shift)
32 n_shift++;
34 assert(n_shift == 2);
36 pdg->free();
37 delete pdg;
39 construct_pdg("arg_order");
40 pdg = get_pn(ctx, "arg_order");
42 assert(pdg->dependences.size() == 1);
43 assert(pdg->dependences[0]->to != pdg->dependences[0]->from);
45 pdg->free();
46 delete pdg;
47 isl_ctx_free(ctx);
49 return 0;