--- ./apronxx/apronxx_test.cc.orig 2009-12-22 06:33:22.000000000 -0700 +++ ./apronxx/apronxx_test.cc 2012-07-25 14:53:57.429804754 -0600 @@ -327,11 +327,13 @@ void test_coeff() void test_dimchange() { + ap_dim_t temp_array1[3] = {1,2,3}; + ap_dim_t temp_array2[3] = {3,2,1}; cout << endl << "dimchange" << endl << "=========" << endl << endl; - dimchange d = dimchange(1,2,(ap_dim_t[]){1,2,3}); + dimchange d = dimchange(1,2,temp_array1); cout << "from array 1 2 3: " << d; - d = (ap_dim_t[]){3,2,1}; + d = temp_array2; cout << "from array 3 2 1: " << d; cout << d.get_intdim() << " " << d.get_realdim() << " " << d.get(0) << " " << d[1] << endl; try { d.get(3); assert(0); } catch (out_of_range& b) {} @@ -362,15 +364,17 @@ void test_dimchange() void test_dimperm() { + ap_dim_t temp_array1[3] = {1,0,2}; + ap_dim_t temp_array2[3] = {1,2,0}; cout << endl << "dimperm" << endl << "=======" << endl << endl; dimperm i = id(3); cout << "identity: " << i << endl; - dimperm d = dimperm(3,(ap_dim_t[]){1,0,2}); + dimperm d = dimperm(3,temp_array1); cout << "from array 1 0 2: " << d; d = id(3); cout << "identity: " << d; - d = (ap_dim_t[]){1,2,0}; + d = temp_array2; cout << "from array 1 2 0: " << d; cout << d.size() << " " << d.get(0) << " " << d[1] << endl; try { d.get(3); assert(0); } catch (out_of_range& b) {} @@ -408,8 +412,10 @@ void test_dimperm() void test_linexpr0() { - dimchange dim = dimchange(1,1,(ap_dim_t[]){0,2}); - dimperm perm = dimperm(3,(ap_dim_t[]){1,0,2}); + ap_dim_t temp_array1[2] = {0,2}; + ap_dim_t temp_array2[3] = {1,0,2}; + dimchange dim = dimchange(1,1,temp_array1); + dimperm perm = dimperm(3,temp_array2); dimperm perm2 = -perm; // dense @@ -554,6 +560,8 @@ void test_linexpr0() void test_lincons0() { + ap_dim_t temp_array1[2] = {0,2}; + ap_dim_t temp_array2[3] = {1,0,2}; cout << endl << "lincons0" << endl << "========" << endl << endl; coeff a[] = {1,2,3}; @@ -568,10 +576,10 @@ void test_lincons0() lincons0 m = l; assert(!l.is_unsat() && l.is_quasilinear() && l.is_linear()); cout << "copy 1x0 + 2x1 + 3x2 + 4 = 0: " << m << endl; - lincons0 n = lincons0(m,dimchange(2,0,(ap_dim_t[]){0,2})); + lincons0 n = lincons0(m,dimchange(2,0,temp_array1)); assert(!n.is_unsat() && n.is_quasilinear() && n.is_linear()); cout << "dimchange 1x1 + 2x2 + 3x4 + 4 = 0: " << n << endl; - lincons0 o = lincons0(m,dimperm(3,(ap_dim_t[]){1,0,2})); + lincons0 o = lincons0(m,dimperm(3,temp_array2)); assert(!o.is_unsat() && o.is_quasilinear() && o.is_linear()); cout << "dimperm 2x0 + 1x1 + 3x2 + 4 = 0: " << o << endl; cout << "unsat: " << lincons0(unsat()) << endl; @@ -582,9 +590,9 @@ void test_lincons0() cout << "unsat: " << l << endl; o = n = lincons0(AP_CONS_EQ,linexpr0(3,a,4)); cout << "chained copy 1x0 + 2x1 + 3x2 + 4 = 0: " << o << endl; - o.add_dimensions(dimchange(2,0,(ap_dim_t[]){0,2})); + o.add_dimensions(dimchange(2,0,temp_array1)); cout << "dimchange 1x1 + 2x2 + 3x4 + 4 = 0: " << o << endl; - n.permute_dimensions(dimperm(3,(ap_dim_t[]){1,0,2})); + n.permute_dimensions(dimperm(3,temp_array2)); cout << "dimperm 2x0 + 1x1 + 3x2 + 4 = 0: " << n << endl; n.resize(2); cout << "resize 2x0 + 1x1 + 4 = 0: " << n << endl; @@ -620,6 +628,8 @@ void test_lincons0() void test_lincons0_array() { + ap_dim_t temp_array1[3] = {1,0,2}; + ap_dim_t temp_array2[2] = {0,2}; cout << endl << "lincons0 array" << endl << "==============" << endl << endl; coeff a[] = {1,2,3}; @@ -631,9 +641,9 @@ void test_lincons0_array() cout << "construct: " << t << endl; lincons0_array u = t; cout << "copy: " << t << endl; - lincons0_array v = lincons0_array(u,dimperm(3,(ap_dim_t[]){1,0,2})); + lincons0_array v = lincons0_array(u,dimperm(3,temp_array1)); cout << "permutation: " << v << endl; - lincons0_array w = lincons0_array(u,dimchange(1,1,(ap_dim_t[]){0,2})); + lincons0_array w = lincons0_array(u,dimchange(1,1,temp_array2)); cout << "dim change: " << w << endl; lincons0 ar[3] = { lincons0(AP_CONS_EQ,linexpr0(3,a,5)), lincons0(AP_CONS_EQ,linexpr0(2,b,4)), @@ -650,10 +660,10 @@ void test_lincons0_array() cout << "from vector: " << x << endl; w = v; cout << "copy: " << w << endl; - w.add_dimensions(dimchange(1,1,(ap_dim_t[]){0,2})); + w.add_dimensions(dimchange(1,1,temp_array2)); cout << "dim change: " << w << endl; w = v; - w.permute_dimensions(dimperm(3,(ap_dim_t[]){1,0,2})); + w.permute_dimensions(dimperm(3,temp_array1)); cout << "permutation: " << w << endl; cout << "size: " << w.size() << endl; assert(w.is_linear() && w.is_quasilinear()); @@ -675,6 +685,8 @@ void test_lincons0_array() void test_generator0() { + ap_dim_t temp_array1[2] = {0,2}; + ap_dim_t temp_array2[3] = {1,0,2}; cout << endl << "generator0" << endl << "==========" << endl << endl; coeff a[] = {1,2,3}; @@ -688,17 +700,17 @@ void test_generator0() generator0 l = generator0(AP_GEN_VERTEX,linexpr0(3,a,4)); generator0 m = l; cout << "copy vert 1x0 + 2x1 + 3x2 + 4: " << m << endl; - generator0 n = generator0(m,dimchange(2,0,(ap_dim_t[]){0,2})); + generator0 n = generator0(m,dimchange(2,0,temp_array1)); cout << "dimchange vert 1x1 + 2x2 + 3x4 + 4: " << n << endl; - generator0 o = generator0(m,dimperm(3,(ap_dim_t[]){1,0,2})); + generator0 o = generator0(m,dimperm(3,temp_array2)); cout << "dimperm vert 2x0 + 1x1 + 3x2 + 4: " << o << endl; l = generator0(AP_GEN_RAY,linexpr0(4,b,5)); cout << "copy ray 4x0 + 3x1 + 2x2 + 1x3 + 5: " << l << endl; o = n = generator0(AP_GEN_LINE,linexpr0(3,a,4)); cout << "chained copy line 1x0 + 2x1 + 3x2 + 4: " << o << endl; - o.add_dimensions(dimchange(2,0,(ap_dim_t[]){0,2})); + o.add_dimensions(dimchange(2,0,temp_array1)); cout << "dimchange line 1x1 + 2x2 + 3x4 + 4: " << o << endl; - n.permute_dimensions(dimperm(3,(ap_dim_t[]){1,0,2})); + n.permute_dimensions(dimperm(3,temp_array2)); cout << "dimperm line 2x0 + 1x1 + 3x2 + 4: " << n << endl; n.resize(2); cout << "resize line 2x0 + 1x1 + 4: " << n << endl; @@ -723,6 +735,8 @@ void test_generator0() void test_generator0_array() { + ap_dim_t temp_array1[3] = {1,0,2}; + ap_dim_t temp_array2[2] = {0,2}; cout << endl << "generator0 array" << endl << "================" << endl << endl; coeff a[] = {1,2,3}; @@ -734,9 +748,9 @@ void test_generator0_array() cout << "construct: " << t << endl; generator0_array u = t; cout << "copy: " << t << endl; - generator0_array v = generator0_array(u,dimperm(3,(ap_dim_t[]){1,0,2})); + generator0_array v = generator0_array(u,dimperm(3,temp_array1)); cout << "permutation: " << v << endl; - generator0_array w = generator0_array(u,dimchange(1,1,(ap_dim_t[]){0,2})); + generator0_array w = generator0_array(u,dimchange(1,1,temp_array2)); cout << "dim change: " << w << endl; generator0 ar[3] = { generator0(AP_GEN_VERTEX,linexpr0(3,a,5)), generator0(AP_GEN_VERTEX,linexpr0(2,b,4)), @@ -753,10 +767,10 @@ void test_generator0_array() cout << "from vector: " << x << endl; w = v; cout << "copy: " << w << endl; - w.add_dimensions(dimchange(1,1,(ap_dim_t[]){0,2})); + w.add_dimensions(dimchange(1,1,temp_array2)); cout << "dim change: " << w << endl; w = v; - w.permute_dimensions(dimperm(3,(ap_dim_t[]){1,0,2})); + w.permute_dimensions(dimperm(3,temp_array1)); cout << "permutation: " << w << endl; cout << "size: " << w.size() << endl; w[0] = generator0(AP_GEN_LINE,linexpr0(2,b,88)); @@ -775,6 +789,8 @@ void test_generator0_array() void test_texpr0() { + ap_dim_t temp_array1[2] = {0,2}; + ap_dim_t temp_array2[3] = {1,0,2}; cout << endl << "texpr0" << endl << "======" << endl << endl; coeff a[] = {1,2,3}; @@ -857,8 +873,8 @@ void test_texpr0() x = y = sqrt(dim(0)+1); cout << "chained assign sqrt(x0+1): " << x << "; " << y << endl; // dimensions - dimchange dimc = dimchange(1,1,(ap_dim_t[]){0,2}); - dimperm perm = dimperm(3,(ap_dim_t[]){1,0,2}); + dimchange dimc = dimchange(1,1,temp_array1); + dimperm perm = dimperm(3,temp_array2); x = dim(0)/dim(1); cout << "add dim x1/x2: " << texpr0(x,dimc) << endl; cout << "del dim ]-oo;+oo[/x0: " << texpr0(x,dimc,false) << endl; @@ -1002,6 +1018,8 @@ void test_texpr0() void test_tcons0() { + ap_dim_t temp_array1[2] = {0,2}; + ap_dim_t temp_array2[3] = {1,0,2}; cout << endl << "tcons0" << endl << "======" << endl << endl; coeff a[] = {1,2,3}; @@ -1026,9 +1044,9 @@ void test_tcons0() assert(!l.is_interval_cst() && !l.is_interval_linear() && l.is_interval_polynomial() && l.is_interval_polyfrac() && l.is_scalar()); cout << "copy x0 * x2 = 0: " << m << endl; - tcons0 n = tcons0(m,dimchange(2,0,(ap_dim_t[]){0,2})); + tcons0 n = tcons0(m,dimchange(2,0,temp_array1)); cout << "dimchange x1 * x4 = 0: " << n << endl; - tcons0 o = tcons0(m,dimperm(3,(ap_dim_t[]){1,0,2})); + tcons0 o = tcons0(m,dimperm(3,temp_array2)); cout << "dimperm x1 * x2 = 0: " << o << endl; cout << "unsat: " << tcons0(unsat()) << endl; l = tcons0(AP_CONS_SUPEQ,dim(0)); @@ -1040,12 +1058,12 @@ void test_tcons0() l.is_interval_polyfrac() && l.is_scalar()); o = n = tcons0(AP_CONS_EQ,dim(0)*dim(2)+2); cout << "chained copy x0 * x2 +2 = 0: " << o << endl; - o.add_dimensions(dimchange(2,0,(ap_dim_t[]){0,2})); + o.add_dimensions(dimchange(2,0,temp_array1)); cout << "dimchange x1 * x4 + 2 = 0: " << o << endl; o = tcons0(AP_CONS_EQ,dim(0)*dim(3)+2); - o.remove_dimensions(dimchange(2,0,(ap_dim_t[]){0,2})); + o.remove_dimensions(dimchange(2,0,temp_array1)); cout << "dimchange ]-oo;+oo[ * x1 + 2 = 0: " << o << endl; - n.permute_dimensions(dimperm(3,(ap_dim_t[]){1,0,2})); + n.permute_dimensions(dimperm(3,temp_array2)); cout << "dimperm x1 * x2 + 2 = 0: " << n << endl; assert(n.get_constyp()==AP_CONS_EQ); n.get_constyp()=AP_CONS_SUP; @@ -1084,6 +1102,8 @@ void test_tcons0() void test_tcons0_array() { + ap_dim_t temp_array1[3] = {1,0,2}; + ap_dim_t temp_array2[2] = {0,2}; cout << endl << "tcons0 array" << endl << "============" << endl << endl; coeff a[] = {1,2,3}; @@ -1095,11 +1115,11 @@ void test_tcons0_array() cout << "construct: " << t << endl; tcons0_array u = t; cout << "copy: " << t << endl; - tcons0_array v = tcons0_array(u,dimperm(3,(ap_dim_t[]){1,0,2})); + tcons0_array v = tcons0_array(u,dimperm(3,temp_array1)); cout << "permutation: " << v << endl; - tcons0_array w = tcons0_array(u,dimchange(1,1,(ap_dim_t[]){0,2})); + tcons0_array w = tcons0_array(u,dimchange(1,1,temp_array2)); cout << "add dim: " << w << endl; - tcons0_array ww = tcons0_array(u,dimchange(1,1,(ap_dim_t[]){0,2}),false); + tcons0_array ww = tcons0_array(u,dimchange(1,1,temp_array2),false); cout << "rem dim: " << ww << endl; tcons0 ar[3] = { tcons0(AP_CONS_SUPEQ,dim(0)*dim(1)*dim(2)), tcons0(AP_CONS_EQ,dim(0)%dim(1)), @@ -1117,13 +1137,13 @@ void test_tcons0_array() cout << "from vector: " << x << endl; w = u; cout << "copy: " << w << endl; - w.add_dimensions(dimchange(1,1,(ap_dim_t[]){0,2})); + w.add_dimensions(dimchange(1,1,temp_array2)); cout << "add dim: " << w << endl; w = u; - w.remove_dimensions(dimchange(1,1,(ap_dim_t[]){0,2})); + w.remove_dimensions(dimchange(1,1,temp_array2)); cout << "del dim: " << w << endl; w = u; - w.permute_dimensions(dimperm(3,(ap_dim_t[]){1,0,2})); + w.permute_dimensions(dimperm(3,temp_array1)); cout << "permutation: " << w << endl; cout << "size: " << w.size() << endl; assert(!w.is_interval_linear()); @@ -1607,7 +1627,6 @@ void test_texpr1() var af[] = { "f1","f3","f2" }; environment env(ai,2,af,2); environment env2(ai,3,af,3); - coeff a[] = {1,2,3}; // construction cout << "construct 2: " << texpr1(env,2) << endl; @@ -1806,7 +1825,6 @@ void test_tcons1_array() var af[] = { "f1","f3","f2" }; environment env(ai,2,af,2); environment env2(ai,3,af,3); - coeff a[] = {1,2,3}; coeff b[] = {5,3}; tcons1_array t = tcons1_array(env,2); try { cout << t; assert(0); } catch (invalid_argument& r) { cout << endl; } @@ -1859,6 +1877,9 @@ void test_tcons1_array() void test_abstract0(manager& m, manager& mm) { + ap_dim_t temp_array1[3] = {1,2,3}; + ap_dim_t temp_array2[5] = {0,1,3,4,2}; + ap_dim_t temp_array3[3] = {0,1,2}; cout << "level 0" << endl << endl; interval i[5] = { @@ -2220,7 +2241,7 @@ void test_abstract0(manager& m, manager& // dim change & permute - dimchange dc = dimchange(1,2,(ap_dim_t[]){1,2,3}); + dimchange dc = dimchange(1,2,temp_array1); a1 = abstract0(m,2,3,ia); add_dimensions(m,a2,a1,dc); add_dimensions(m,a3,a1,dc,true); @@ -2235,7 +2256,7 @@ void test_abstract0(manager& m, manager& assert(a1==abstract0(m,2,3,ia)); cout << "remove dim: " << a1 << endl; - dimperm dp = dimperm(5,(ap_dim_t[]){0,1,3,4,2}); + dimperm dp = dimperm(5,temp_array2); a1 = abstract0(m,2,3,ia); permute_dimensions(m,a2,a1,dp); a1.permute_dimensions(m,dp); @@ -2243,7 +2264,7 @@ void test_abstract0(manager& m, manager& cout << "permute dim: " << a1 << endl; a1.permute_dimensions(m,-dp); assert(a1==abstract0(m,2,3,ia)); - try { a1.permute_dimensions(m,dimperm(3,(ap_dim_t[]){0,1,2})); assert(0); } + try { a1.permute_dimensions(m,dimperm(3,temp_array3)); assert(0); } catch (invalid_argument&c) {} // expand fold