4#include "GrayLevelImage2D.hpp"
8 GrayLevelImage2D img(8, 8, 5);
9 assert(img.w() == 8 && img.h() == 8);
10 for (
int y = 0; y < img.h(); ++y) {
11 for (
int x = 0; x < img.w(); ++x) {
12 assert(img.at(x, y) == 5);
14 std::cout <<
' ' << int(img.at(x, y));
20 const GrayLevelImage2D& cimg = img;
21 assert(cimg.at(2, 3) == 42);
23 GrayLevelImage2D copie = img;
25 assert(cimg.at(2, 3) == 42);
27 for (
int y = 0; y < copie.h(); ++y)
28 for (
int x = 0; x < copie.w(); ++x)
29 assert(copie.at(x, y) == 12);
31 GrayLevelImage2D vide;
32 assert(vide.w() == 0 && vide.h() == 0);
33 bool exceptionRecue =
false;
36 }
catch (
const std::out_of_range&) {
37 exceptionRecue =
true;
39 assert(exceptionRecue);
40 std::cout <<
"Tests de la partie 2 passes.\n";