summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-19 17:12:14 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-19 18:39:45 +0300
commit886794b8a1ff563f9d5c9952935a9b330b652a14 (patch)
tree96f10f7473bdf3efd1d9fb74a28fb1fd31582fb5
parenta407b7c3660628cb3a6b96b3f5e61bb59c9958d2 (diff)
downloadmanaplus-886794b8a1ff563f9d5c9952935a9b330b652a14.tar.gz
manaplus-886794b8a1ff563f9d5c9952935a9b330b652a14.tar.bz2
manaplus-886794b8a1ff563f9d5c9952935a9b330b652a14.tar.xz
manaplus-886794b8a1ff563f9d5c9952935a9b330b652a14.zip
Fix some warnings in unit tests.
-rw-r--r--src/fs/virtfs/virtfs1_unittest.cc1
-rw-r--r--src/localconsts.h8
-rw-r--r--src/resources/map/maplayer_unittest.cc36
-rw-r--r--src/resources/resourcemanager/resourcemanager_unittest.cc3
-rw-r--r--src/utils/checkutils_unittest.cc21
5 files changed, 23 insertions, 46 deletions
diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc
index 5d48e4238..87ecd1671 100644
--- a/src/fs/virtfs/virtfs1_unittest.cc
+++ b/src/fs/virtfs/virtfs1_unittest.cc
@@ -1612,7 +1612,6 @@ TEST_CASE("VirtFs1 enumerateFiles3", "")
VirtFs::List *list = nullptr;
list = VirtFs::enumerateFiles("/");
- const size_t sz = list->names.size();
REQUIRE(inList(list, "file1.txt"));
REQUIRE(inList(list, "file2.txt"));
VirtFs::freeList(list);
diff --git a/src/localconsts.h b/src/localconsts.h
index 4039fc54b..8e0a24bf7 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -252,6 +252,14 @@
#else // GCC_VERSION > 40600
#define PRAGMA45(str)
#endif // GCC_VERSION > 40600
+
+#if GCC_VERSION >= 40000
+#define PRAGMA4(str) _Pragma(#str)
+#elif defined(__clang__)
+#define PRAGMA4(str) _Pragma(#str)
+#else // GCC_VERSION > 40000
+#define PRAGMA4(str)
+#endif // GCC_VERSION > 40000
#endif // __GNUC__
#ifdef __GNUC__
diff --git a/src/resources/map/maplayer_unittest.cc b/src/resources/map/maplayer_unittest.cc
index cdd948670..5c001f543 100644
--- a/src/resources/map/maplayer_unittest.cc
+++ b/src/resources/map/maplayer_unittest.cc
@@ -1118,7 +1118,6 @@ TEST_CASE("MapLayer draw", "")
0);
layer->setTile(0, 0, img1);
map->addLayer(layer);
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(1, 1);
layer->draw(mock,
@@ -1167,7 +1166,6 @@ TEST_CASE("MapLayer draw", "")
0);
layer->setTile(0, 0, img1);
map->addLayer(layer);
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(2, 1);
layer->draw(mock,
@@ -1218,7 +1216,6 @@ TEST_CASE("MapLayer draw", "")
layer->setTile(0, 0, img1);
layer->setTile(1, 0, img2);
map->addLayer(layer);
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(2, 1);
layer->draw(mock,
@@ -1265,7 +1262,6 @@ TEST_CASE("MapLayer draw", "")
layer->setTile(0, 0, img1);
layer->setTile(1, 0, img1);
map->addLayer(layer);
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(2, 1);
layer->draw(mock,
@@ -1308,7 +1304,6 @@ TEST_CASE("MapLayer draw", "")
layer->setTile(0, 0, img1);
layer->setTile(2, 0, img1);
map->addLayer(layer);
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(3, 1);
layer->draw(mock,
@@ -1355,7 +1350,6 @@ TEST_CASE("MapLayer draw", "")
layer->setTile(0, 0, img1);
layer->setTile(1, 0, img1);
map->addLayer(layer);
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(3, 1);
layer->draw(mock,
@@ -1399,7 +1393,6 @@ TEST_CASE("MapLayer draw", "")
layer->setTile(1, 0, img1);
layer->setTile(2, 0, img2);
map->addLayer(layer);
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(3, 1);
layer->draw(mock,
@@ -1516,7 +1509,6 @@ TEST_CASE("MapLayer draw", "")
layer->setTile(16, 10, img1);
layer->setTile(17, 10, img1);
map->addLayer(layer);
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(maxX, maxY);
layer->draw(mock,
@@ -1684,7 +1676,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getSpecialLayer();
layer->drawSpecialLayer(mock,
@@ -1715,7 +1706,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getSpecialLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->updateCache();
@@ -1744,7 +1734,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getSpecialLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->updateCache();
@@ -1773,7 +1762,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getSpecialLayer();
specialLayer->setTile(1, 0, MapItemType::ARROW_UP);
specialLayer->updateCache();
@@ -1802,7 +1790,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getSpecialLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->setTile(1, 0, MapItemType::ARROW_UP);
@@ -1835,7 +1822,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getSpecialLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->setTile(2, 0, MapItemType::ARROW_UP);
@@ -1868,7 +1854,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getSpecialLayer();
specialLayer->setTile(1, 0, MapItemType::ARROW_UP);
specialLayer->setTile(2, 0, MapItemType::ARROW_UP);
@@ -1901,7 +1886,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getSpecialLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->setTile(1, 0, MapItemType::ARROW_DOWN);
@@ -1940,7 +1924,6 @@ TEST_CASE("MapLayer drawSpecialLayer (specialLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getSpecialLayer();
specialLayer->setTile(0, 5, MapItemType::ARROW_UP);
specialLayer->setTile(1, 5, MapItemType::ARROW_DOWN);
@@ -2038,7 +2021,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getTempLayer();
layer->drawSpecialLayer(mock,
@@ -2069,7 +2051,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getTempLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->updateCache();
@@ -2098,7 +2079,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getTempLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->updateCache();
@@ -2127,7 +2107,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getTempLayer();
const int *const cache = specialLayer->getCache();
REQUIRE(cache[0] == 10000);
@@ -2162,7 +2141,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getTempLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->setTile(1, 0, MapItemType::ARROW_UP);
@@ -2195,7 +2173,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getTempLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->setTile(2, 0, MapItemType::ARROW_UP);
@@ -2228,7 +2205,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getTempLayer();
specialLayer->setTile(1, 0, MapItemType::ARROW_UP);
specialLayer->setTile(2, 0, MapItemType::ARROW_UP);
@@ -2261,7 +2237,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getTempLayer();
specialLayer->setTile(0, 0, MapItemType::ARROW_UP);
specialLayer->setTile(1, 0, MapItemType::ARROW_DOWN);
@@ -2300,7 +2275,6 @@ TEST_CASE("MapLayer drawSpecialLayer (tempLayer)", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
specialLayer = map->getTempLayer();
specialLayer->setTile(0, 5, MapItemType::ARROW_UP);
specialLayer->setTile(1, 5, MapItemType::ARROW_DOWN);
@@ -2407,7 +2381,6 @@ TEST_CASE("MapLayer drawFringe", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(1, 1);
layer->drawFringe(mock,
@@ -2461,7 +2434,6 @@ TEST_CASE("MapLayer drawFringe", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(2, 1);
layer->drawFringe(mock,
@@ -2517,7 +2489,6 @@ TEST_CASE("MapLayer drawFringe", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(2, 1);
layer->drawFringe(mock,
@@ -2568,7 +2539,6 @@ TEST_CASE("MapLayer drawFringe", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(2, 1);
layer->drawFringe(mock,
@@ -2615,7 +2585,6 @@ TEST_CASE("MapLayer drawFringe", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(3, 1);
layer->drawFringe(mock,
@@ -2666,7 +2635,6 @@ TEST_CASE("MapLayer drawFringe", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(3, 1);
layer->drawFringe(mock,
@@ -2714,7 +2682,6 @@ TEST_CASE("MapLayer drawFringe", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(3, 1);
layer->drawFringe(mock,
@@ -2839,7 +2806,6 @@ TEST_CASE("MapLayer drawFringe", "")
map->addLayer(layer);
layer->setSpecialLayer(map->getSpecialLayer());
layer->setTempLayer(map->getTempLayer());
- TileInfo *const tiles = layer->getTiles();
layer->updateCache(maxX, maxY);
layer->drawFringe(mock,
@@ -3003,7 +2969,6 @@ TEST_CASE("MapLayer drawFringe", "")
SpecialLayer *const tempLayer = map->getTempLayer();
layer->setSpecialLayer(specialLayer);
layer->setTempLayer(tempLayer);
- TileInfo *const tiles = layer->getTiles();
specialLayer->setTile(1, 10, MapItemType::ARROW_UP);
specialLayer->setTile(10, 10, MapItemType::ARROW_DOWN);
specialLayer->updateCache();
@@ -3136,7 +3101,6 @@ TEST_CASE("MapLayer drawFringe", "")
SpecialLayer *const tempLayer = map->getTempLayer();
layer->setSpecialLayer(specialLayer);
layer->setTempLayer(tempLayer);
- TileInfo *const tiles = layer->getTiles();
specialLayer->setTile(0, 10, MapItemType::ARROW_UP);
specialLayer->setTile(10, 10, MapItemType::ARROW_DOWN);
specialLayer->setTile(90, 10, MapItemType::ARROW_DOWN);
diff --git a/src/resources/resourcemanager/resourcemanager_unittest.cc b/src/resources/resourcemanager/resourcemanager_unittest.cc
index 0908ae78d..49599e972 100644
--- a/src/resources/resourcemanager/resourcemanager_unittest.cc
+++ b/src/resources/resourcemanager/resourcemanager_unittest.cc
@@ -77,9 +77,6 @@ namespace
return nullptr;
}
- const TestLoader *const rl
- = static_cast<const TestLoader *const>(v);
-
Resource *const res = new TestResource();
BLOCK_END("TestLoader::load")
return res;
diff --git a/src/utils/checkutils_unittest.cc b/src/utils/checkutils_unittest.cc
index 4dbc23062..644752306 100644
--- a/src/utils/checkutils_unittest.cc
+++ b/src/utils/checkutils_unittest.cc
@@ -104,24 +104,33 @@ TEST_CASE("CheckUtils", "")
SECTION("failFalse")
{
- REQUIRE_THROWS(failFalse(false) == false);
+PRAGMA4(GCC diagnostic push)
+PRAGMA4(GCC diagnostic ignored "-Wunused-value")
+ REQUIRE_THROWS(failFalse(false));
REQUIRE(failFalse(true) == true);
- REQUIRE_THROWS(reportFalse(false) == false);
+ REQUIRE_THROWS(reportFalse(false));
REQUIRE(reportFalse(true) == true);
+PRAGMA4(GCC diagnostic pop)
}
SECTION("failTrue")
{
+PRAGMA4(GCC diagnostic push)
+PRAGMA4(GCC diagnostic ignored "-Wunused-value")
REQUIRE(failTrue(false) == false);
- REQUIRE_THROWS(failTrue(true) == true);
+ REQUIRE_THROWS(failTrue(true));
REQUIRE(reportTrue(false) == false);
- REQUIRE_THROWS(reportTrue(true) == true);
+ REQUIRE_THROWS(reportTrue(true));
+PRAGMA4(GCC diagnostic pop)
}
SECTION("failAlways")
{
- REQUIRE_THROWS(testFailAlways1() == true);
- REQUIRE_THROWS(testFailAlways2() == true);
+PRAGMA4(GCC diagnostic push)
+PRAGMA4(GCC diagnostic ignored "-Wunused-value")
+ REQUIRE_THROWS(testFailAlways1());
+ REQUIRE_THROWS(testFailAlways2());
+PRAGMA4(GCC diagnostic pop)
}
SECTION("returnFalseV")