ex02: add test

This commit is contained in:
Camille Chauvet 2023-10-04 15:27:25 +00:00
parent c49545d3ff
commit cc70b96d30

View File

@ -24,14 +24,39 @@ int main()
} }
} }
std::cout << "Fill and get"; std::cout << "Fill and get" << std::endl;
{ {
unsigned int size = 10; unsigned int size = 10;
Array<int> t(size); Array<int> t(size);
for (unsigned int i = 0; i != size; i++) for (unsigned int i = 0; i != size; i++)
t[i] = i; t[i] = i;
for (unsigned int i = 0; i != size; i++) for (unsigned int i = 0; i != size; i++)
std::cout << i << std::endl; std::cout << t[i] << std::endl;
}
std::cout << std::endl;
std::cout << "Copy and get" << std::endl;
{
unsigned int size = 10;
Array<int> t(size);
for (unsigned int i = 0; i != size; i++)
t[i] = i;
Array<int> b(t);
for (unsigned int i = 0; i != size; i++)
std::cout << b[i] << std::endl;
}
std::cout << std::endl;
std::cout << "operator = and get" << std::endl;
{
unsigned int size = 10;
Array<int> t(size);
for (unsigned int i = 0; i != size; i++)
t[i] = i;
Array<int> b;
b = t;
for (unsigned int i = 0; i != size; i++)
std::cout << b[i] << std::endl;
} }
std::cout << std::endl; std::cout << std::endl;
} }