summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-04-03 12:27:14 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-04-05 11:49:17 +0200
commit3ceabcd3ec91dbd9458d3c5b78fb12c3182636e1 (patch)
treeb8be2ac790afce844178a314b42683ab9d06f744 /test
parentd7aaf83421261087a99d18d92eca9637c1bf72f8 (diff)
downloadqtlocation-mapboxgl-3ceabcd3ec91dbd9458d3c5b78fb12c3182636e1.tar.gz
[core] clang-tidy fixes
Diffstat (limited to 'test')
-rw-r--r--test/actor/actor.test.cpp2
-rw-r--r--test/api/custom_layer.test.cpp8
-rw-r--r--test/map/map.test.cpp2
-rw-r--r--test/src/mbgl/test/sqlite3_test_fs.cpp50
-rw-r--r--test/storage/offline_database.test.cpp2
-rw-r--r--test/style/filter.test.cpp8
-rw-r--r--test/text/glyph_manager.test.cpp4
-rw-r--r--test/util/merge_lines.test.cpp2
-rw-r--r--test/util/peer.test.cpp12
-rw-r--r--test/util/tile_cover.test.cpp12
10 files changed, 51 insertions, 51 deletions
diff --git a/test/actor/actor.test.cpp b/test/actor/actor.test.cpp
index 7493abe263..02308b7ce0 100644
--- a/test/actor/actor.test.cpp
+++ b/test/actor/actor.test.cpp
@@ -101,7 +101,7 @@ TEST(Actor, DestructionBlocksOnSend) {
waited(false) {
}
- ~TestScheduler() {
+ ~TestScheduler() override {
EXPECT_TRUE(waited.load());
}
diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp
index c836ab81ac..4a0a34bafc 100644
--- a/test/api/custom_layer.test.cpp
+++ b/test/api/custom_layer.test.cpp
@@ -39,7 +39,7 @@ void main() {
class TestLayer : public mbgl::style::CustomLayerHost {
public:
- void initialize() {
+ void initialize() override {
program = MBGL_CHECK_ERROR(glCreateProgram());
vertexShader = MBGL_CHECK_ERROR(glCreateShader(GL_VERTEX_SHADER));
fragmentShader = MBGL_CHECK_ERROR(glCreateShader(GL_FRAGMENT_SHADER));
@@ -59,7 +59,7 @@ public:
MBGL_CHECK_ERROR(glBufferData(GL_ARRAY_BUFFER, 6 * sizeof(GLfloat), triangle, GL_STATIC_DRAW));
}
- void render(const mbgl::style::CustomLayerRenderParameters&) {
+ void render(const mbgl::style::CustomLayerRenderParameters&) override {
MBGL_CHECK_ERROR(glUseProgram(program));
MBGL_CHECK_ERROR(glBindBuffer(GL_ARRAY_BUFFER, buffer));
MBGL_CHECK_ERROR(glEnableVertexAttribArray(a_pos));
@@ -67,9 +67,9 @@ public:
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, 3));
}
- void contextLost() {}
+ void contextLost() override {}
- void deinitialize() {
+ void deinitialize() override {
if (program) {
MBGL_CHECK_ERROR(glDeleteBuffers(1, &buffer));
MBGL_CHECK_ERROR(glDetachShader(program, vertexShader));
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index a2d36b2ca2..3af2acdb8b 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -48,7 +48,7 @@ public:
template <typename T = FileSource>
MapTest(const std::string& cachePath, const std::string& assetPath,
float pixelRatio = 1, MapMode mode = MapMode::Static,
- typename std::enable_if<std::is_same<T, DefaultFileSource>::value>::type* = 0)
+ typename std::enable_if<std::is_same<T, DefaultFileSource>::value>::type* = nullptr)
: fileSource(std::make_shared<T>(cachePath, assetPath))
, frontend(pixelRatio, threadPool)
, map(frontend, observer, fileSource, threadPool,
diff --git a/test/src/mbgl/test/sqlite3_test_fs.cpp b/test/src/mbgl/test/sqlite3_test_fs.cpp
index 16d411faff..e4f958c900 100644
--- a/test/src/mbgl/test/sqlite3_test_fs.cpp
+++ b/test/src/mbgl/test/sqlite3_test_fs.cpp
@@ -29,11 +29,11 @@ static int sqlite3_test_fs_close(sqlite3_file* pFile) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
const int rc = file->real->pMethods->xClose(file->real);
if (rc == SQLITE_OK) {
sqlite3_free((void*)file->base.pMethods);
- file->base.pMethods = 0;
+ file->base.pMethods = nullptr;
}
return rc;
}
@@ -52,7 +52,7 @@ static int sqlite3_test_fs_read(sqlite3_file* pFile, void* zBuf, int iAmt, sqlit
}
sqlite3_test_fs_read_limit -= iAmt;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xRead(file->real, zBuf, iAmt, iOfst);
}
@@ -70,7 +70,7 @@ static int sqlite3_test_fs_write(sqlite3_file* pFile, const void* zBuf, int iAmt
}
sqlite3_test_fs_write_limit -= iAmt;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xWrite(file->real, zBuf, iAmt, iOfst);
}
@@ -81,7 +81,7 @@ static int sqlite3_test_fs_truncate(sqlite3_file* pFile, sqlite3_int64 size) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xTruncate(file->real, size);
}
@@ -92,7 +92,7 @@ static int sqlite3_test_fs_sync(sqlite3_file* pFile, int flags) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xSync(file->real, flags);
}
@@ -103,7 +103,7 @@ static int sqlite3_test_fs_file_size(sqlite3_file* pFile, sqlite3_int64* pSize)
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xFileSize(file->real, pSize);
}
@@ -111,7 +111,7 @@ static int sqlite3_test_fs_lock(sqlite3_file* pFile, int eLock) {
if (sqlite3_test_fs_debug) {
fprintf(stderr, "SQLite3: lock(%p, %d)\n", pFile, eLock);
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xLock(file->real, eLock);
}
@@ -119,7 +119,7 @@ static int sqlite3_test_fs_unlock(sqlite3_file* pFile, int eLock) {
if (sqlite3_test_fs_debug) {
fprintf(stderr, "SQLite3: unlock(%p, %d)\n", pFile, eLock);
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xUnlock(file->real, eLock);
}
@@ -127,7 +127,7 @@ static int sqlite3_test_fs_check_reserved_lock(sqlite3_file* pFile, int* pResOut
if (sqlite3_test_fs_debug) {
fprintf(stderr, "SQLite3: check_reserved_lock(%p)\n", pFile);
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xCheckReservedLock(file->real, pResOut);
}
@@ -138,7 +138,7 @@ static int sqlite3_test_fs_file_control(sqlite3_file* pFile, int op, void* pArg)
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xFileControl(file->real, op, pArg);
}
@@ -149,7 +149,7 @@ static int sqlite3_test_fs_sector_size(sqlite3_file* pFile) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xSectorSize(file->real);
}
@@ -160,7 +160,7 @@ static int sqlite3_test_fs_device_characteristics(sqlite3_file* pFile) {
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- File* file = (File*)pFile;
+ auto* file = (File*)pFile;
return file->real->pMethods->xDeviceCharacteristics(file->real);
}
@@ -169,34 +169,34 @@ static int sqlite3_test_fs_open(sqlite3_vfs* vfs, const char* zName, sqlite3_fil
fprintf(stderr, "SQLite3: open(name=%s, flags=%d) -> %p\n", zName, flags, pFile);
}
if (!sqlite3_test_fs_io) {
- pFile->pMethods = NULL;
+ pFile->pMethods = nullptr;
return SQLITE_AUTH;
}
if (!sqlite3_test_fs_file_open) {
- pFile->pMethods = NULL;
+ pFile->pMethods = nullptr;
return SQLITE_CANTOPEN;
}
- File* file = (File*)pFile;
- sqlite3_vfs* unix_fs = (sqlite3_vfs*)vfs->pAppData;
+ auto* file = (File*)pFile;
+ auto* unix_fs = (sqlite3_vfs*)vfs->pAppData;
file->real = (sqlite3_file*)&file[1];
if (!sqlite3_test_fs_file_create) {
int res;
const int result = unix_fs->xAccess(vfs, zName, SQLITE_ACCESS_EXISTS, &res);
if (result != SQLITE_OK) {
- pFile->pMethods = NULL;
+ pFile->pMethods = nullptr;
return result;
}
if (res != 1) {
- pFile->pMethods = NULL;
+ pFile->pMethods = nullptr;
return SQLITE_CANTOPEN;
}
}
const int status = unix_fs->xOpen(unix_fs, zName, file->real, flags, pOutFlags);
if (file->real->pMethods) {
- sqlite3_io_methods* methods = (sqlite3_io_methods*)sqlite3_malloc(sizeof(sqlite3_io_methods));
+ auto* methods = (sqlite3_io_methods*)sqlite3_malloc(sizeof(sqlite3_io_methods));
memset(methods, 0, sizeof(sqlite3_io_methods));
methods->iVersion = 1;
methods->xClose = sqlite3_test_fs_close;
@@ -223,7 +223,7 @@ static int sqlite3_test_fs_delete(sqlite3_vfs* vfs, const char *zPath, int dirSy
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- sqlite3_vfs* unix_fs = (sqlite3_vfs*)vfs->pAppData;
+ auto* unix_fs = (sqlite3_vfs*)vfs->pAppData;
return unix_fs->xDelete(unix_fs, zPath, dirSync);
}
@@ -234,7 +234,7 @@ static int sqlite3_test_fs_access(sqlite3_vfs* vfs, const char *zPath, int flags
if (!sqlite3_test_fs_io) {
return SQLITE_AUTH;
}
- sqlite3_vfs* unix_fs = (sqlite3_vfs*)vfs->pAppData;
+ auto* unix_fs = (sqlite3_vfs*)vfs->pAppData;
return unix_fs->xAccess(unix_fs, zPath, flags, pResOut);
}
@@ -243,12 +243,12 @@ namespace test {
SQLite3TestFS::SQLite3TestFS() {
sqlite3_vfs* unix_fs = sqlite3_vfs_find("unix");
- if (unix_fs == 0) {
+ if (unix_fs == nullptr) {
abort();
}
- sqlite3_vfs* test_fs = (sqlite3_vfs*)sqlite3_malloc(sizeof(sqlite3_vfs));
- if (test_fs == 0) {
+ auto* test_fs = (sqlite3_vfs*)sqlite3_malloc(sizeof(sqlite3_vfs));
+ if (test_fs == nullptr) {
abort();
}
memset(test_fs, 0, sizeof(sqlite3_vfs));
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp
index 744803a4b2..90cdc13d7c 100644
--- a/test/storage/offline_database.test.cpp
+++ b/test/storage/offline_database.test.cpp
@@ -91,7 +91,7 @@ const Response response = [] {
return res;
}();
-} // namespace
+} // namespace fixture
TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Create)) {
FixtureLog log;
diff --git a/test/style/filter.test.cpp b/test/style/filter.test.cpp
index ef38a1a789..40219108bb 100644
--- a/test/style/filter.test.cpp
+++ b/test/style/filter.test.cpp
@@ -117,10 +117,10 @@ TEST(Filter, EqualsType) {
ASSERT_TRUE(filter(f, {{}}, {}, FeatureType::LineString, {}));
ASSERT_FALSE(filter(f, {{}}, {}, FeatureType::Point, {}));
- invalidFilter("[\"==\", \"$type\"]");
- invalidFilter("[\"==\", \"$type\", null]");
- invalidFilter("[\"==\", \"$type\", \"foo\", 1]");
- invalidFilter("[\"==\", \"$type\", \"foo\", \"Point\"]");
+ invalidFilter(R"(["==", "$type"])");
+ invalidFilter(R"(["==", "$type", null])");
+ invalidFilter(R"(["==", "$type", "foo", 1])");
+ invalidFilter(R"(["==", "$type", "foo", "Point"])");
}
TEST(Filter, InType) {
diff --git a/test/text/glyph_manager.test.cpp b/test/text/glyph_manager.test.cpp
index 3d7a220dc5..3dcf1e204c 100644
--- a/test/text/glyph_manager.test.cpp
+++ b/test/text/glyph_manager.test.cpp
@@ -19,11 +19,11 @@ static constexpr const size_t stubBitmapLength = 900;
class StubLocalGlyphRasterizer : public LocalGlyphRasterizer {
public:
- bool canRasterizeGlyph(const FontStack&, GlyphID glyphID) {
+ bool canRasterizeGlyph(const FontStack&, GlyphID glyphID) override {
return util::i18n::allowsIdeographicBreaking(glyphID);
}
- Glyph rasterizeGlyph(const FontStack&, GlyphID glyphID) {
+ Glyph rasterizeGlyph(const FontStack&, GlyphID glyphID) override {
Glyph stub;
stub.id = glyphID;
diff --git a/test/util/merge_lines.test.cpp b/test/util/merge_lines.test.cpp
index 1d4b0d230e..1c8c7aae8f 100644
--- a/test/util/merge_lines.test.cpp
+++ b/test/util/merge_lines.test.cpp
@@ -15,7 +15,7 @@ namespace {
PropertyMap properties;
LineString<int16_t> emptyLine;
-}
+} // namespace
class SymbolFeatureStub : public SymbolFeature {
public:
diff --git a/test/util/peer.test.cpp b/test/util/peer.test.cpp
index aa5a4cc538..a808dd27d1 100644
--- a/test/util/peer.test.cpp
+++ b/test/util/peer.test.cpp
@@ -6,7 +6,7 @@ using namespace mbgl::util;
class TestType {
public:
- TestType() : i1(0), i2(1) {
+ TestType() {
str[0] = 'a';
}
@@ -18,14 +18,14 @@ public:
TestType(const TestType&) = delete;
TestType& operator=(const TestType&) = delete;
- int i1;
- int i2;
+ int i1 = 0;
+ int i2 = 1;
char str[256];
};
bool IsStackAllocated (const peer& a, const void* obj1) {
- uintptr_t a_ptr = (uintptr_t)(&a);
- uintptr_t obj = (uintptr_t)(obj1);
+ auto a_ptr = (uintptr_t)(&a);
+ auto obj = (uintptr_t)(obj1);
return (obj >= a_ptr && obj < a_ptr + sizeof(peer));
};
@@ -163,7 +163,7 @@ TEST(Peer, UniquePtr) {
EXPECT_FALSE(u1.has_value());
peer u2;
- TestType * t3 = new TestType();
+ auto* t3 = new TestType();
u2 = std::unique_ptr<TestType>(t3);
EXPECT_TRUE(u2.has_value());
}
diff --git a/test/util/tile_cover.test.cpp b/test/util/tile_cover.test.cpp
index 7045305625..3fc7681520 100644
--- a/test/util/tile_cover.test.cpp
+++ b/test/util/tile_cover.test.cpp
@@ -3,8 +3,8 @@
#include <mbgl/map/transform.hpp>
#include <algorithm>
-#include <stdlib.h> /* srand, rand */
-#include <time.h> /* time */
+#include <cstdlib> /* srand, rand */
+#include <ctime> /* time */
#include <gtest/gtest.h>
using namespace mbgl;
@@ -314,9 +314,9 @@ TEST(TileCount, BoundsCrossingAntimeridian) {
}
TEST(TileCover, DISABLED_FuzzPoly) {
- while(1)
+ while(true)
{
- std::srand (time(NULL));
+ std::srand (time(nullptr));
std::size_t len = std::rand() % 10000 + 3;
Polygon<double> polygon;
@@ -342,9 +342,9 @@ TEST(TileCover, DISABLED_FuzzPoly) {
}
TEST(TileCover, DISABLED_FuzzLine) {
- while(1)
+ while(true)
{
- std::srand (time(NULL));
+ std::srand (time(nullptr));
std::size_t len = std::rand() % 10000 + 3;
MultiLineString<double> mls;