Advertisement
cepxuozab

TileSetPixel

May 27th, 2024
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1. void CheckTileFill(const Tile &tile, char color){
  2.         for (auto i = 0; i < Tile::SIZE; ++i){
  3.             for (auto j = 0; j < Tile::SIZE; ++j){
  4.                 ASSERT_EQUAL(tile.GetPixel({i, j}), color);
  5.             }
  6.         }
  7.     }
  8. Test:
  9. const char color = '#';
  10.         Tile tile(color);
  11.         CheckTileFill(tile, color);
  12.         Point p1({1, 2});
  13.         const char color_1 = '1';
  14.         Point p2({5, 3});
  15.         const char color_2 = '2';
  16.         Point p3({0, 0});
  17.         const char color_3 = '3';
  18.    
  19.         tile.SetPixel(p1, color_1);
  20.         tile.SetPixel(p2, color_2);
  21.         tile.SetPixel(p3, color_3);
  22.         tile.SetPixel({-10, 100}, 's');
  23.         ASSERT_EQUAL(tile.GetPixel(p1), color_1);
  24.         ASSERT_EQUAL(tile.GetPixel(p2), color_2);
  25.         ASSERT_EQUAL(tile.GetPixel(p3), color_3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement