45 namespace Test {
namespace Int {
48 namespace Arithmetic {
61 :
Test(
"Arithmetic::Mult::XYZ::"+
str(icl)+
"::"+s,3,d,false,icl) {}
64 double d0 =
static_cast<double>(x[0]);
65 double d1 =
static_cast<double>(x[1]);
66 double d2 =
static_cast<double>(x[2]);
81 :
Test(
"Arithmetic::Mult::XXY::"+
str(icl)+
"::"+s,2,d,false,icl) {}
84 double d0 =
static_cast<double>(x[0]);
85 double d1 =
static_cast<double>(x[0]);
86 double d2 =
static_cast<double>(x[1]);
101 :
Test(
"Arithmetic::Mult::XYX::"+
str(icl)+
"::"+s,2,d,false,icl) {}
104 double d0 =
static_cast<double>(x[0]);
105 double d1 =
static_cast<double>(x[1]);
106 double d2 =
static_cast<double>(x[0]);
121 :
Test(
"Arithmetic::Mult::XYY::"+
str(icl)+
"::"+s,2,d,false,icl) {}
124 double d0 =
static_cast<double>(x[0]);
125 double d1 =
static_cast<double>(x[1]);
126 double d2 =
static_cast<double>(x[1]);
141 :
Test(
"Arithmetic::Mult::XXX::"+
str(icl)+
"::"+s,1,d,false,icl) {}
144 double d0 =
static_cast<double>(x[0]);
145 double d1 =
static_cast<double>(x[0]);
146 double d2 =
static_cast<double>(x[0]);
161 :
Test(
"Arithmetic::Sqr::XY::"+
str(icl)+
"::"+s,2,d,false,icl) {}
164 double d0 =
static_cast<double>(x[0]);
165 double d1 =
static_cast<double>(x[1]);
180 :
Test(
"Arithmetic::Sqr::XX::"+
str(icl)+
"::"+s,1,d,false,icl) {}
183 double d0 =
static_cast<double>(x[0]);
198 :
Test(
"Arithmetic::Sqrt::XY::"+
str(icl)+
"::"+s,2,d,false,icl) {}
201 double d0 =
static_cast<double>(x[0]);
202 double d1 =
static_cast<double>(x[1]);
203 return (d0 >= 0) && (d0 >= d1*
d1) && (d0 < (d1+1)*(d1+1));
217 :
Test(
"Arithmetic::Sqrt::XX::"+
str(icl)+
"::"+s,1,d,false,icl) {}
220 double d0 =
static_cast<double>(x[0]);
221 return (d0 >= 0) && (d0 >= d0*d0) && (d0 < (d0+1)*(d0+1));
238 :
Test(
"Arithmetic::Pow::XY::"+
str(n0)+
"::"+
str(icl)+
"::"+s,
239 2,d,false,icl),
n(n0) {}
243 for (
int i=0;
i<
n;
i++) {
253 using namespace Gecode;
270 :
Test(
"Arithmetic::Pow::XX::"+
str(n0)+
"::"+
str(icl)+
"::"+s,
271 1,d,false,icl),
n(n0) {}
275 for (
int i=0;
i<
n;
i++) {
298 :
Test(
"Arithmetic::Nroot::XY::"+
str(n0)+
"::"+
str(icl)+
"::"+s,
299 2,d,false,icl),
n(n0) {}
302 if ((x[0] < 0) || (x[1] < 0))
306 for (
int i=0;
i<
n;
i++) {
307 l *= x[1]; u *= x[1]+1;
311 return (x[0] >= l) && (x[0] <
u);
315 using namespace Gecode;
332 :
Test(
"Arithmetic::Nroot::XX::"+
str(n0)+
"::"+
str(icl)+
"::"+s,
333 1,d,false,icl),
n(n0) {}
340 for (
int i=0;
i<
n;
i++) {
341 l *= x[0]; u *= x[0]+1;
345 return (x[0] >= l) && (x[0] <
u);
357 static int abs(
int a) {
return a<0 ? -a:
a; }
359 static int sgn(
int a) {
return a<0 ? -1:1; }
363 :
Test(
"Arithmetic::DivMod::"+s,4,d) {}
366 return x[0] == x[1]*x[2]+x[3] &&
368 (x[3] == 0 || sgn(x[3]) == sgn(x[0]));
381 :
Test(
"Arithmetic::Div::"+s,3,d) {}
386 int divsign = (x[0] / x[1] < 0) ? -1 : 1;
389 static_cast<int>(floor(static_cast<double>(
std::abs(x[0]))/
390 static_cast<double>(
std::abs(x[1]))));
391 return x[2] == divresult;
404 :
Test(
"Arithmetic::Mod::"+s,3,d) {}
409 int divsign = (x[0] / x[1] < 0) ? -1 : 1;
412 static_cast<int>(floor(static_cast<double>(
std::abs(x[0]))/
413 static_cast<double>(
std::abs(x[1]))));
414 return x[0] == x[1]*divresult+x[2];
428 :
Test(
"Arithmetic::Abs::XY::"+
str(icl)+
"::"+s,2,d,false,icl) {}
431 double d0 =
static_cast<double>(x[0]);
432 double d1 =
static_cast<double>(x[1]);
433 return (d0<0 ? -d0 : d0) ==
d1;
447 :
Test(
"Arithmetic::Abs::XX::"+
str(icl)+
"::"+s,1,d,false,icl) {}
450 double d0 =
static_cast<double>(x[0]);
451 double d1 =
static_cast<double>(x[0]);
452 return (d0<0 ? -d0 : d0) ==
d1;
466 :
Test(
"Arithmetic::Min::Bin::XYZ::"+
str(icl)+
"::"+s,3,d,false,icl) {}
483 :
Test(
"Arithmetic::Min::Bin::XYX::"+
str(icl)+
"::"+s,2,d) {}
500 :
Test(
"Arithmetic::Min::Bin::XYX::"+
str(icl)+
"::"+s,2,d) {}
517 :
Test(
"Arithmetic::Min::Bin::XYY::"+
str(icl)+
"::"+s,2,d) {}
534 :
Test(
"Arithmetic::Min::Bin::XXX::"+
str(icl)+
"::"+s,1,d) {}
551 :
Test(
"Arithmetic::Max::Bin::XYZ::"+
str(icl)+
"::"+s,3,d) {
570 :
Test(
"Arithmetic::Max::Bin::XXY::"+
str(icl)+
"::"+s,2,d) {}
587 :
Test(
"Arithmetic::Max::Bin::XYX::"+
str(icl)+
"::"+s,2,d) {}
604 :
Test(
"Arithmetic::Max::Bin::XYY::"+
str(icl)+
"::"+s,2,d) {}
621 :
Test(
"Arithmetic::Max::Bin::XXX::"+
str(icl)+
"::"+s,1,d) {}
637 :
Test(
"Arithmetic::Min::Nary::"+
str(icl),4,-4,4,false,icl) {}
645 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
655 :
Test(
"Arithmetic::Min::Nary::Shared::"+
str(icl),3,-4,4,false,icl) {}
663 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
673 :
Test(
"Arithmetic::Max::Nary::"+
str(icl),4,-4,4,false,icl) {}
681 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
691 :
Test(
"Arithmetic::Max::Nary::Shared::"+
str(icl),3,-4,4,false,icl) {}
699 m[0]=x[0]; m[1]=x[1]; m[2]=x[2];
717 static_cast<int>(-
sqrt(static_cast<double>
720 static_cast<int>(
sqrt(static_cast<double>
733 (void)
new Div(
"A",a);
734 (void)
new Div(
"B",b);
735 (void)
new Div(
"C",c);
737 (void)
new Mod(
"A",a);
738 (void)
new Mod(
"B",b);
739 (void)
new Mod(
"C",c);
744 (void)
new MultXYZ(
"A",a,icls.icl());
745 (void)
new MultXYZ(
"B",b,icls.icl());
746 (void)
new MultXYZ(
"C",c,icls.icl());
748 (void)
new MultXXY(
"A",a,icls.icl());
749 (void)
new MultXXY(
"B",b,icls.icl());
750 (void)
new MultXXY(
"C",c,icls.icl());
752 (void)
new MultXYX(
"A",a,icls.icl());
753 (void)
new MultXYX(
"B",b,icls.icl());
754 (void)
new MultXYX(
"C",c,icls.icl());
756 (void)
new MultXYY(
"A",a,icls.icl());
757 (void)
new MultXYY(
"B",b,icls.icl());
758 (void)
new MultXYY(
"C",c,icls.icl());
760 (void)
new MultXXX(
"A",a,icls.icl());
761 (void)
new MultXXX(
"B",b,icls.icl());
762 (void)
new MultXXX(
"C",c,icls.icl());
764 (void)
new SqrXY(
"A",a,icls.icl());
765 (void)
new SqrXY(
"B",b,icls.icl());
766 (void)
new SqrXY(
"C",c,icls.icl());
768 (void)
new SqrXX(
"A",a,icls.icl());
769 (void)
new SqrXX(
"B",b,icls.icl());
770 (void)
new SqrXX(
"C",c,icls.icl());
772 for (
int n=0;
n<=6;
n++) {
773 (void)
new PowXY(
"A",
n,a,icls.icl());
774 (void)
new PowXY(
"B",
n,b,icls.icl());
775 (void)
new PowXY(
"C",
n,c,icls.icl());
776 (void)
new PowXY(
"D",
n,d,icls.icl());
778 (void)
new PowXX(
"A",
n,a,icls.icl());
779 (void)
new PowXX(
"B",
n,b,icls.icl());
780 (void)
new PowXX(
"C",
n,c,icls.icl());
781 (void)
new PowXX(
"D",
n,d,icls.icl());
784 for (
int n=1;
n<=6;
n++) {
785 (void)
new NrootXY(
"A",
n,a,icls.icl());
786 (void)
new NrootXY(
"B",
n,b,icls.icl());
787 (void)
new NrootXY(
"C",
n,c,icls.icl());
788 (void)
new NrootXY(
"D",
n,d,icls.icl());
790 (void)
new NrootXX(
"A",
n,a,icls.icl());
791 (void)
new NrootXX(
"B",
n,b,icls.icl());
792 (void)
new NrootXX(
"C",
n,c,icls.icl());
793 (void)
new NrootXX(
"D",
n,d,icls.icl());
796 for (
int n=30;
n<=34;
n++) {
797 (void)
new PowXY(
"C",
n,c,icls.icl());
798 (void)
new PowXX(
"C",
n,c,icls.icl());
799 (void)
new NrootXY(
"C",
n,c,icls.icl());
800 (void)
new NrootXX(
"C",
n,c,icls.icl());
803 (void)
new SqrtXY(
"A",a,icls.icl());
804 (void)
new SqrtXY(
"B",b,icls.icl());
805 (void)
new SqrtXY(
"C",c,icls.icl());
807 (void)
new SqrtXX(
"A",a,icls.icl());
808 (void)
new SqrtXX(
"B",b,icls.icl());
809 (void)
new SqrtXX(
"C",c,icls.icl());
811 (void)
new AbsXY(
"A",a,icls.icl());
812 (void)
new AbsXY(
"B",b,icls.icl());
813 (void)
new AbsXY(
"C",c,icls.icl());
815 (void)
new AbsXX(
"A",a,icls.icl());
816 (void)
new AbsXX(
"B",b,icls.icl());
817 (void)
new AbsXX(
"C",c,icls.icl());
819 (void)
new MinXYZ(
"A",a,icls.icl());
820 (void)
new MinXYZ(
"B",b,icls.icl());
821 (void)
new MinXYZ(
"C",c,icls.icl());
823 (void)
new MinXXY(
"A",a,icls.icl());
824 (void)
new MinXXY(
"B",b,icls.icl());
825 (void)
new MinXXY(
"C",c,icls.icl());
827 (void)
new MinXYX(
"A",a,icls.icl());
828 (void)
new MinXYX(
"B",b,icls.icl());
829 (void)
new MinXYX(
"C",c,icls.icl());
831 (void)
new MinXYY(
"A",a,icls.icl());
832 (void)
new MinXYY(
"B",b,icls.icl());
833 (void)
new MinXYY(
"C",c,icls.icl());
835 (void)
new MinXXX(
"A",a,icls.icl());
836 (void)
new MinXXX(
"B",b,icls.icl());
837 (void)
new MinXXX(
"C",c,icls.icl());
839 (void)
new MaxXYZ(
"A",a,icls.icl());
840 (void)
new MaxXYZ(
"B",b,icls.icl());
841 (void)
new MaxXYZ(
"C",c,icls.icl());
843 (void)
new MaxXXY(
"A",a,icls.icl());
844 (void)
new MaxXXY(
"B",b,icls.icl());
845 (void)
new MaxXXY(
"C",c,icls.icl());
847 (void)
new MaxXYX(
"A",a,icls.icl());
848 (void)
new MaxXYX(
"B",b,icls.icl());
849 (void)
new MaxXYX(
"C",c,icls.icl());
851 (void)
new MaxXYY(
"A",a,icls.icl());
852 (void)
new MaxXYY(
"B",b,icls.icl());
853 (void)
new MaxXYY(
"C",c,icls.icl());
855 (void)
new MaxXXX(
"A",a,icls.icl());
856 (void)
new MaxXXX(
"B",b,icls.icl());
857 (void)
new MaxXXX(
"C",c,icls.icl());
859 (void)
new MinNary(icls.icl());
861 (void)
new MaxNary(icls.icl());