namespace std {
template <class X>
class initializer_list {
public:
initializer_list();
};
}
class Foo {
public:
Foo();
Foo(std::initializer_list<int>);
bool operator==(const Foo);
Foo operator+(const Foo);
};
#define EQ(x,y) (void)(x == y)
void test_EQ() {
Foo F;
F = Foo{1,2};
EQ(F,F);
EQ(F,Foo());
EQ(F,Foo({1,2,3}));
EQ(Foo({1,2,3}),F);
EQ((Foo{1,2,3}),(Foo{1,2,3}));
EQ(F, F + F);
EQ(F, Foo({1,2,3}) + Foo({1,2,3}));
EQ(F, (Foo{1,2,3} + Foo{1,2,3}));
EQ(F,Foo{1,2,3});
EQ(Foo{1,2,3},F);
EQ(Foo{1,2,3},Foo{1,2,3});
EQ(Foo{1,2,3} + Foo{1,2,3}, F);
EQ(F, Foo({1,2,3}) + Foo{1,2,3});
EQ(F, Foo{1,2,3} + Foo{1,2,3});
}
#define NE(x,y) (void)(x != y)
void test_NE() {
Foo F;
NE(F,F);
NE(F,Foo());
NE(F,Foo({1,2,3}));
NE((Foo{1,2,3}),(Foo{1,2,3}));
NE(F,Foo{1,2,3});
NE(Foo{1,2,3},F);
NE(Foo{1,2,3},Foo{1,2,3});
NE(Foo{1,2,3} + Foo{1,2,3}, F);
NE(F, Foo({1,2,3}) + Foo{1,2,3});
NE(F, Foo{1,2,3} + Foo{1,2,3});
}
#define INIT(var, init) Foo var = init;
void test() {
INIT(a, Foo());
INIT(b, Foo({1, 2, 3}));
INIT(c, Foo());
INIT(d, Foo{1, 2, 3});
INIT(e, {1, 2, 3});
INIT(e, {1, 2, 3} + {1, 2, 3});
}
#define M(name,a,b,c,d,e,f,g,h,i,j,k,l) \
Foo name = a + b + c + d + e + f + g + h + i + j + k + l;
void test2() {
M(F1, Foo(), Foo(), Foo(), Foo(), Foo(), Foo(),
Foo(), Foo(), Foo(), Foo(), Foo(), Foo());
M(F2, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3},
Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3}, Foo{1,2,3});
M(F3, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3},
{1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3}, {1,2,3});
}