Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void TileCoWTest(){
- using namespace std;
- {
- Tile tile_1('1');
- cout << Tile::GetInstanceCount() << endl;
- tile_1.SetPixel({1, 2}, 's');
- cout << Tile::GetInstanceCount() << endl;
- Tile tile_2(tile_1);
- cout << Tile::GetInstanceCount() << endl;
- tile_2.SetPixel({1, 2}, 'n');
- cout << Tile::GetInstanceCount() << endl;
- tile_1.SetPixel({1, 2}, 'w');
- cout << Tile::GetInstanceCount() << endl;
- }
- {
- Tile tile('1');
- tile.SetPixel({1, 2}, 's');
- cout << Tile::GetInstanceCount() << endl;
- Tile tile2('2');
- cout << Tile::GetInstanceCount() << endl;
- tile2.SetPixel({1, 2}, 'n');
- cout << Tile::GetInstanceCount() << endl;
- }
- }
- /*
- 1
- 1
- 2
- 2
- 2
- 1
- 2
- 2
- */
- void ImageCoWTest(){
- using namespace std;
- cout << Tile::GetInstanceCount() << endl;
- auto side = Tile::SIZE;
- const Size size{side * 2 + 3, side * 2 + 5};
- const char color = 'g';
- Image img(size, color);
- cout << Tile::GetInstanceCount() << endl;
- char new_color = 'n';
- img.SetPixel({0, 0}, new_color);
- cout << Tile::GetInstanceCount() << endl;
- img.SetPixel({1, 1}, new_color);
- cout << Tile::GetInstanceCount() << endl;
- img.SetPixel({side + 2, 0}, new_color);
- cout << Tile::GetInstanceCount() << endl;
- img.SetPixel({0, side + 2}, new_color);
- cout << Tile::GetInstanceCount() << endl;
- img.SetPixel({side + 3, side + 2}, new_color);
- cout << Tile::GetInstanceCount() << endl;
- Image img2 = img;
- cout << Tile::GetInstanceCount() << endl;
- img2.SetPixel({side + 1, side + 1}, new_color);
- cout << Tile::GetInstanceCount() << endl;
- Print(img, cout);
- Print(img2, cout);
- }
- /*
- 0
- 1
- 2
- 2
- 3
- 4
- 5
- 5
- 6
- ngggggggggngggggggg
- gnggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- nggggggggggnggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ngggggggggngggggggg
- gnggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- gggggggggnggggggggg
- nggggggggggnggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- ggggggggggggggggggg
- */
Add Comment
Please, Sign In to add comment