From a7da8806e8ecb984fb6ef36e202e634bebb99be2 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 3 Jul 2011 14:02:43 +0200 Subject: [PATCH] test: use isl interface for testing lattice widths Signed-off-by: Sven Verdoolaege --- Makefile.am | 2 -- test.c | 31 ++++++++++++++++--------------- tests/lattice_width/jon_1 | 2 +- tests/lattice_width/jon_2 | 2 +- tests/lattice_width/jon_3 | 2 +- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/Makefile.am b/Makefile.am index df4b2ea..ada4e5e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -216,8 +216,6 @@ LDADD = libbarvinok.la @ISL_POLYLIB_LIBS@ @ISL_LIBS@ \ @POLYLIB_LIBS@ test_SOURCES = \ - evalue_read.c \ - evalue_read.h \ test.c testlib_SOURCES = \ evalue_read.c \ diff --git a/test.c b/test.c index 0d8b2ff..9fb0492 100644 --- a/test.c +++ b/test.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -35,12 +36,14 @@ static void time_diff(struct tms *before, struct tms *after) int main(int argc, char **argv) { + isl_ctx *ctx; int i, nbPol, nbVec, nbMat, func, j, n; Polyhedron *A, *B, *C, *D, *E, *F, *G; char s[128]; struct barvinok_options *options = barvinok_options_new_with_defaults(); argc = barvinok_options_parse(options, argc, argv, ISL_ARG_ALL); + ctx = isl_ctx_alloc_with_options(barvinok_options_arg, options); nbPol = nbVec = nbMat = 0; fgets(s, 128, stdin); @@ -207,22 +210,20 @@ int main(int argc, char **argv) break; } case 11: { - evalue *expected, *computed; - unsigned nvar, nparam; - const char **pp; + isl_dim *dim; + isl_basic_set *bset; + isl_pw_qpolynomial *expected, *computed; + unsigned nparam; - expected = evalue_read_from_file(stdin, NULL, &pp, &nvar, &nparam, - options->MaxRays); - C = Universe_Polyhedron(0); - computed = Polyhedron_Lattice_Width(A, C, options); - assert(value_zero_p(computed->d)); - assert(computed->x.p->type == partition); - if (!eequal(expected, &computed->x.p->arr[1])) + expected = isl_pw_qpolynomial_read_from_file(ctx, stdin); + nparam = isl_pw_qpolynomial_dim(expected, isl_dim_param); + dim = isl_dim_set_alloc(ctx, nparam, A->Dimension - nparam); + bset = isl_basic_set_new_from_polylib(A, dim); + computed = isl_basic_set_lattice_width(bset); + computed = isl_pw_qpolynomial_sub(computed, expected); + if (!isl_pw_qpolynomial_is_zero(computed)) return -1; - free(pp); - Domain_Free(C); - evalue_free(computed); - evalue_free(expected); + isl_pw_qpolynomial_free(computed); break; } case 12: { @@ -267,6 +268,6 @@ int main(int argc, char **argv) Matrix_Free(S); } - barvinok_options_free(options); + isl_ctx_free(ctx); return 0; } diff --git a/tests/lattice_width/jon_1 b/tests/lattice_width/jon_1 index 766d6d6..04647b5 100644 --- a/tests/lattice_width/jon_1 +++ b/tests/lattice_width/jon_1 @@ -8,4 +8,4 @@ D 1 1 -1 3 -3 4 F 11 -3 +{ 3 } diff --git a/tests/lattice_width/jon_2 b/tests/lattice_width/jon_2 index 878c983..dce2b8a 100644 --- a/tests/lattice_width/jon_2 +++ b/tests/lattice_width/jon_2 @@ -7,4 +7,4 @@ D 1 1 0 1 2 0 -5 F 11 -1 +{ 1 } diff --git a/tests/lattice_width/jon_3 b/tests/lattice_width/jon_3 index 2b1d078..5956aaa 100644 --- a/tests/lattice_width/jon_3 +++ b/tests/lattice_width/jon_3 @@ -8,4 +8,4 @@ D 1 1 -3 -1 6 4 2 -12 F 11 -1 +{ 1 } -- 2.11.4.GIT