diff options
41 files changed, 196 insertions, 288 deletions
diff --git a/include/mbgl/platform/darwin/settings_nsuserdefaults.hpp b/include/mbgl/platform/darwin/settings_nsuserdefaults.hpp deleted file mode 100644 index b0ca060b85..0000000000 --- a/include/mbgl/platform/darwin/settings_nsuserdefaults.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#import <mbgl/ios/MGLTypes.h> - -namespace mbgl { - -class Settings_NSUserDefaults { -public: - Settings_NSUserDefaults(); - void load(); - void save(); - void clear(); - -public: - double longitude = 0; - double latitude = 0; - double zoom = 0; - double bearing = 0; - double pitch = 0; - - MGLUserTrackingMode userTrackingMode = MGLUserTrackingModeNone; - bool showsUserLocation = false; - - uint32_t debug = 0; -}; - -} diff --git a/include/mbgl/platform/event.hpp b/include/mbgl/platform/event.hpp index 0b3b79df6b..f082114946 100644 --- a/include/mbgl/platform/event.hpp +++ b/include/mbgl/platform/event.hpp @@ -19,7 +19,7 @@ MBGL_DEFINE_ENUM_CLASS(EventSeverityClass, EventSeverity, { { EventSeverity::Warning, "WARNING" }, { EventSeverity::Error, "ERROR" }, { EventSeverity(-1), "UNKNOWN" }, -}); +}) enum class Event : uint8_t { General, @@ -58,7 +58,7 @@ MBGL_DEFINE_ENUM_CLASS(EventClass, Event, { { Event::Crash, "Crash" }, { Event::Glyph, "Glyph" }, { Event(-1), "Unknown" }, -}); +}) struct EventPermutation { diff --git a/include/mbgl/style/types.hpp b/include/mbgl/style/types.hpp index 3be7b5d9c7..ece56026df 100644 --- a/include/mbgl/style/types.hpp +++ b/include/mbgl/style/types.hpp @@ -19,7 +19,7 @@ MBGL_DEFINE_ENUM_CLASS(SourceTypeClass, SourceType, { { SourceType::GeoJSON, "geojson" }, { SourceType::Video, "video" }, { SourceType::Annotations, "annotations" }, -}); +}) namespace style { diff --git a/include/mbgl/util/constants.hpp b/include/mbgl/util/constants.hpp index 621fc1820e..543d5b3cab 100644 --- a/include/mbgl/util/constants.hpp +++ b/include/mbgl/util/constants.hpp @@ -35,7 +35,7 @@ constexpr double PITCH_MAX = M_PI / 3; constexpr double MIN_ZOOM = 0.0; constexpr double MAX_ZOOM = 25.5; -constexpr uint64_t DEFAULT_MAX_CACHE_SIZE = 50 * 1024 * 1024;; +constexpr uint64_t DEFAULT_MAX_CACHE_SIZE = 50 * 1024 * 1024; constexpr Duration DEFAULT_FADE_DURATION = Milliseconds(300); constexpr Seconds CLOCK_SKEW_RETRY_TIMEOUT { 30 }; diff --git a/platform/darwin/src/settings_nsuserdefaults.mm b/platform/darwin/src/settings_nsuserdefaults.mm deleted file mode 100644 index 548ee9b220..0000000000 --- a/platform/darwin/src/settings_nsuserdefaults.mm +++ /dev/null @@ -1,60 +0,0 @@ -#import <Foundation/Foundation.h> - -#include <mbgl/platform/darwin/settings_nsuserdefaults.hpp> - -using namespace mbgl; - -Settings_NSUserDefaults::Settings_NSUserDefaults() -{ - [[NSUserDefaults standardUserDefaults] registerDefaults:@{ - @"longitude" : @(longitude), - @"latitude" : @(latitude), - @"zoom" : @(zoom), - @"bearing" : @(bearing), - @"pitch" : @(pitch), - @"userTrackingMode" : @(userTrackingMode), - @"showsUserLocation" : @(showsUserLocation), - @"debug" : @(debug), - }]; - load(); -} - -void Settings_NSUserDefaults::load() -{ - NSDictionary *settings = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]; - - longitude = [settings[@"longitude"] doubleValue]; - latitude = [settings[@"latitude"] doubleValue]; - zoom = [settings[@"zoom"] doubleValue]; - bearing = [settings[@"bearing"] doubleValue]; - pitch = [settings[@"pitch"] doubleValue]; - debug = [settings[@"debug"] boolValue]; - - unsigned uncheckedTrackingMode = [settings[@"userTrackingMode"] unsignedIntValue]; - if (uncheckedTrackingMode > MGLUserTrackingModeNone && - uncheckedTrackingMode <= MGLUserTrackingModeFollowWithCourse) - { - userTrackingMode = (MGLUserTrackingMode)uncheckedTrackingMode; - } - showsUserLocation = [settings[@"showsUserLocation"] boolValue]; -} - -void Settings_NSUserDefaults::save() -{ - [[NSUserDefaults standardUserDefaults] setValuesForKeysWithDictionary:@{ - @"longitude" : @(longitude), - @"latitude" : @(latitude), - @"zoom" : @(zoom), - @"bearing" : @(bearing), - @"pitch" : @(pitch), - @"userTrackingMode" : @(userTrackingMode), - @"showsUserLocation" : @(showsUserLocation), - @"debug" : @(debug), - }]; - [[NSUserDefaults standardUserDefaults] synchronize]; -} - -void Settings_NSUserDefaults::clear() -{ - [NSUserDefaults resetStandardUserDefaults]; -} diff --git a/platform/default/run_loop.cpp b/platform/default/run_loop.cpp index 6230e8f1ab..29ebe168f5 100644 --- a/platform/default/run_loop.cpp +++ b/platform/default/run_loop.cpp @@ -14,9 +14,9 @@ using namespace mbgl::util; static ThreadLocal<RunLoop>& current = *new ThreadLocal<RunLoop>; #if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10 -void dummyCallback(uv_async_t*, int) {}; +void dummyCallback(uv_async_t*, int) {} #else -void dummyCallback(uv_async_t*) {}; +void dummyCallback(uv_async_t*) {} #endif } // namespace diff --git a/src/mbgl/geometry/glyph_atlas.cpp b/src/mbgl/geometry/glyph_atlas.cpp index b4687b8e07..524b99c12b 100644 --- a/src/mbgl/geometry/glyph_atlas.cpp +++ b/src/mbgl/geometry/glyph_atlas.cpp @@ -197,4 +197,4 @@ void GlyphAtlas::bind(gl::ObjectStore& store) { } else { MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, *texture)); } -}; +} diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp index 830640f780..b1f012d484 100644 --- a/src/mbgl/geometry/line_atlas.cpp +++ b/src/mbgl/geometry/line_atlas.cpp @@ -119,7 +119,7 @@ LinePatternPos LineAtlas::addDash(const std::vector<float> &dasharray, bool roun bind(store); return position; -}; +} void LineAtlas::upload(gl::ObjectStore& store) { if (dirty) { @@ -171,4 +171,4 @@ void LineAtlas::bind(gl::ObjectStore& store) { dirty = false; } -}; +} diff --git a/src/mbgl/map/camera.cpp b/src/mbgl/map/camera.cpp deleted file mode 100644 index 4a45e904f8..0000000000 --- a/src/mbgl/map/camera.cpp +++ /dev/null @@ -1 +0,0 @@ -#include <mbgl/map/camera.hpp> diff --git a/src/mbgl/renderer/frame_history.cpp b/src/mbgl/renderer/frame_history.cpp index dbaf8fbf7a..5173d9d5a1 100644 --- a/src/mbgl/renderer/frame_history.cpp +++ b/src/mbgl/renderer/frame_history.cpp @@ -6,7 +6,7 @@ using namespace mbgl; FrameHistory::FrameHistory() { changeOpacities.fill(0); opacities.fill(0); -}; +} void FrameHistory::record(const TimePoint& now, float zoom, const Duration& duration) { diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp index fb312661a7..ff2c80c147 100644 --- a/src/mbgl/renderer/symbol_bucket.cpp +++ b/src/mbgl/renderer/symbol_bucket.cpp @@ -57,7 +57,7 @@ SymbolInstance::SymbolInstance(Anchor& anchor, const GeometryCoordinates& line, // Create the collision features that will be used to check whether this symbol instance can be placed textCollisionFeature(line, anchor, shapedText, textBoxScale, textPadding, textAlongLine, indexedFeature), iconCollisionFeature(line, anchor, shapedIcon, iconBoxScale, iconPadding, iconAlongLine, indexedFeature) - {}; + {} SymbolBucket::SymbolBucket(uint32_t overscaling_, float zoom_, const MapMode mode_, const std::string& bucketName_, const std::string& sourceLayerName_) diff --git a/src/mbgl/sprite/sprite_atlas.cpp b/src/mbgl/sprite/sprite_atlas.cpp index 5d7d01deb3..df821a990a 100644 --- a/src/mbgl/sprite/sprite_atlas.cpp +++ b/src/mbgl/sprite/sprite_atlas.cpp @@ -243,7 +243,7 @@ void SpriteAtlas::bind(bool linear, gl::ObjectStore& objectStore) { // pixelWidth, pixelHeight, pixelWidth, pixelHeight); #endif } -}; +} SpriteAtlas::~SpriteAtlas() = default; diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp index 28a7d2e81b..fb82a2084c 100644 --- a/src/mbgl/style/parser.cpp +++ b/src/mbgl/style/parser.cpp @@ -484,7 +484,7 @@ void Parser::parseLayer(const std::string& id, const JSValue& value, std::unique MBGL_DEFINE_ENUM_CLASS(VisibilityTypeClass, VisibilityType, { { VisibilityType::Visible, "visible" }, { VisibilityType::None, "none" }, -}); +}) void Parser::parseVisibility(Layer& layer, const JSValue& value) { Layer::Impl& impl = *layer.baseImpl; diff --git a/src/mbgl/style/property_evaluator.cpp b/src/mbgl/style/property_evaluator.cpp index ce132e0b5b..3993456b6d 100644 --- a/src/mbgl/style/property_evaluator.cpp +++ b/src/mbgl/style/property_evaluator.cpp @@ -21,15 +21,15 @@ template <> inline std::vector<std::string> defaultStopsValue() { return {{}}; } template <> inline std::array<float, 2> defaultStopsValue() { return {{ 0, 0 }}; } template <> inline std::string defaultStopsValue() { return {}; } -template <> inline TranslateAnchorType defaultStopsValue() { return {}; }; -template <> inline RotateAnchorType defaultStopsValue() { return {}; }; -template <> inline LineCapType defaultStopsValue() { return {}; }; -template <> inline LineJoinType defaultStopsValue() { return {}; }; -template <> inline SymbolPlacementType defaultStopsValue() { return {}; }; -template <> inline TextAnchorType defaultStopsValue() { return {}; }; -template <> inline TextJustifyType defaultStopsValue() { return {}; }; -template <> inline TextTransformType defaultStopsValue() { return {}; }; -template <> inline AlignmentType defaultStopsValue() { return {}; }; +template <> inline TranslateAnchorType defaultStopsValue() { return {}; } +template <> inline RotateAnchorType defaultStopsValue() { return {}; } +template <> inline LineCapType defaultStopsValue() { return {}; } +template <> inline LineJoinType defaultStopsValue() { return {}; } +template <> inline SymbolPlacementType defaultStopsValue() { return {}; } +template <> inline TextAnchorType defaultStopsValue() { return {}; } +template <> inline TextJustifyType defaultStopsValue() { return {}; } +template <> inline TextTransformType defaultStopsValue() { return {}; } +template <> inline AlignmentType defaultStopsValue() { return {}; } template <typename T> T PropertyEvaluator<T>::operator()(const Function<T>& fn) const { diff --git a/src/mbgl/style/property_parsing.cpp b/src/mbgl/style/property_parsing.cpp index ecfa85595d..6e5174e936 100644 --- a/src/mbgl/style/property_parsing.cpp +++ b/src/mbgl/style/property_parsing.cpp @@ -58,7 +58,7 @@ optional<Color> parseConstant(const char* name, const JSValue& value) { MBGL_DEFINE_ENUM_CLASS(TranslateAnchorTypeClass, TranslateAnchorType, { { TranslateAnchorType::Map, "map" }, { TranslateAnchorType::Viewport, "viewport" }, -}); +}) template <> optional<TranslateAnchorType> parseConstant(const char* name, const JSValue& value) { @@ -73,7 +73,7 @@ optional<TranslateAnchorType> parseConstant(const char* name, const JSValue& val MBGL_DEFINE_ENUM_CLASS(RotateAnchorTypeClass, RotateAnchorType, { { RotateAnchorType::Map, "map" }, { RotateAnchorType::Viewport, "viewport" }, -}); +}) template <> optional<RotateAnchorType> parseConstant<RotateAnchorType>(const char* name, const JSValue& value) { @@ -89,7 +89,7 @@ MBGL_DEFINE_ENUM_CLASS(LineCapTypeClass, LineCapType, { { LineCapType::Round, "round" }, { LineCapType::Butt, "butt" }, { LineCapType::Square, "square" }, -}); +}) template <> optional<LineCapType> parseConstant<LineCapType>(const char* name, const JSValue& value) { @@ -107,7 +107,7 @@ MBGL_DEFINE_ENUM_CLASS(LineJoinTypeClass, LineJoinType, { { LineJoinType::Round, "round" }, { LineJoinType::FakeRound, "fakeround" }, { LineJoinType::FlipBevel, "flipbevel" }, -}); +}) template <> optional<LineJoinType> parseConstant<LineJoinType>(const char* name, const JSValue& value) { @@ -122,7 +122,7 @@ optional<LineJoinType> parseConstant<LineJoinType>(const char* name, const JSVal MBGL_DEFINE_ENUM_CLASS(SymbolPlacementTypeClass, SymbolPlacementType, { { SymbolPlacementType::Point, "point" }, { SymbolPlacementType::Line, "line" }, -}); +}) template <> optional<SymbolPlacementType> parseConstant<SymbolPlacementType>(const char* name, const JSValue& value) { @@ -144,7 +144,7 @@ MBGL_DEFINE_ENUM_CLASS(TextAnchorTypeClass, TextAnchorType, { { TextAnchorType::TopRight, "top-right" }, { TextAnchorType::BottomLeft, "bottom-left" }, { TextAnchorType::BottomRight, "bottom-right" } -}); +}) template <> optional<TextAnchorType> parseConstant<TextAnchorType>(const char* name, const JSValue& value) { @@ -160,7 +160,7 @@ MBGL_DEFINE_ENUM_CLASS(TextJustifyTypeClass, TextJustifyType, { { TextJustifyType::Center, "center" }, { TextJustifyType::Left, "left" }, { TextJustifyType::Right, "right" }, -}); +}) template <> optional<TextJustifyType> parseConstant<TextJustifyType>(const char* name, const JSValue& value) { @@ -176,7 +176,7 @@ MBGL_DEFINE_ENUM_CLASS(TextTransformTypeClass, TextTransformType, { { TextTransformType::None, "none" }, { TextTransformType::Uppercase, "uppercase" }, { TextTransformType::Lowercase, "lowercase" }, -}); +}) template <> optional<TextTransformType> parseConstant<TextTransformType>(const char* name, const JSValue& value) { @@ -191,7 +191,7 @@ optional<TextTransformType> parseConstant<TextTransformType>(const char* name, c MBGL_DEFINE_ENUM_CLASS(AlignmentTypeClass, AlignmentType, { { AlignmentType::Map, "map" }, { AlignmentType::Viewport, "viewport" }, -}); +}) template <> optional<AlignmentType> parseConstant<AlignmentType>(const char* name, const JSValue& value) { diff --git a/src/mbgl/tile/tile.cpp b/src/mbgl/tile/tile.cpp deleted file mode 100644 index a1d36421a4..0000000000 --- a/src/mbgl/tile/tile.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include <mbgl/tile/tile.hpp> - -using namespace mbgl; diff --git a/src/mbgl/tile/tile_cache.cpp b/src/mbgl/tile/tile_cache.cpp index e012ef0b7e..619d813fd2 100644 --- a/src/mbgl/tile/tile_cache.cpp +++ b/src/mbgl/tile/tile_cache.cpp @@ -37,7 +37,7 @@ void TileCache::add(const OverscaledTileID& key, std::unique_ptr<TileData> data) } assert(orderedKeys.size() <= size); -}; +} std::unique_ptr<TileData> TileCache::get(const OverscaledTileID& key) { @@ -52,7 +52,7 @@ std::unique_ptr<TileData> TileCache::get(const OverscaledTileID& key) { } return data; -}; +} bool TileCache::has(const OverscaledTileID& key) { return tiles.find(key) != tiles.end(); diff --git a/src/mbgl/util/grid_index.cpp b/src/mbgl/util/grid_index.cpp index 4877a90e72..cc31faeee1 100644 --- a/src/mbgl/util/grid_index.cpp +++ b/src/mbgl/util/grid_index.cpp @@ -17,7 +17,7 @@ GridIndex<T>::GridIndex(int32_t extent_, int32_t n_, int32_t padding_) : max(extent + double(padding) / n * extent) { cells.resize(d * d); - }; + } template <class T> void GridIndex<T>::insert(T&& t, const BBox& bbox) { diff --git a/src/mbgl/util/mat2.cpp b/src/mbgl/util/mat2.cpp index 6910244541..ca60dce9c5 100644 --- a/src/mbgl/util/mat2.cpp +++ b/src/mbgl/util/mat2.cpp @@ -41,7 +41,7 @@ void matrix::rotate(mat2& out, const mat2& a, double rad) { out[1] = a1 * c + a3 * s; out[2] = a0 * -s + a2 * c; out[3] = a1 * -s + a3 * c; -}; +} void matrix::scale(mat2& out, const mat2& a, double v0, double v1) { double a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; diff --git a/src/mbgl/util/mat3.cpp b/src/mbgl/util/mat3.cpp index f4ae8841d5..88c769790e 100644 --- a/src/mbgl/util/mat3.cpp +++ b/src/mbgl/util/mat3.cpp @@ -80,7 +80,7 @@ void matrix::rotate(mat3& out, const mat3& a, double rad) { out[6] = a20; out[7] = a21; out[8] = a22; -}; +} void matrix::scale(mat3& out, const mat3& a, double x, double y) { out[0] = x * a[0]; diff --git a/src/mbgl/util/tile_coordinate.cpp b/src/mbgl/util/tile_coordinate.cpp deleted file mode 100644 index d9a0ea352c..0000000000 --- a/src/mbgl/util/tile_coordinate.cpp +++ /dev/null @@ -1 +0,0 @@ -#include <mbgl/util/tile_coordinate.hpp> diff --git a/src/mbgl/util/work_task.cpp b/src/mbgl/util/work_task.cpp deleted file mode 100644 index e69de29bb2..0000000000 --- a/src/mbgl/util/work_task.cpp +++ /dev/null diff --git a/test/api/annotations.cpp b/test/api/annotations.cpp index 60d7db6baa..fefc1c79b1 100644 --- a/test/api/annotations.cpp +++ b/test/api/annotations.cpp @@ -195,7 +195,7 @@ TEST(Annotations, QueryRenderedFeatures) { test.map.addAnnotation(SymbolAnnotation { Point<double> { 0, 0 }, "default_marker" }); test::render(test.map); - + auto features = test.map.queryRenderedFeatures(test.map.pixelForLatLng({ 0, 0 })); - EXPECT_EQ(features.size(), 1); + EXPECT_EQ(features.size(), 1u); } diff --git a/test/api/render_missing.cpp b/test/api/render_missing.cpp index e0fb8e4c55..135c1ecae5 100644 --- a/test/api/render_missing.cpp +++ b/test/api/render_missing.cpp @@ -56,7 +56,7 @@ TEST(API, TEST_REQUIRES_SERVER(RenderMissingTile)) { auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); - EXPECT_EQ(1, flo->count(FixtureLog::Message( + EXPECT_EQ(1u, flo->count(FixtureLog::Message( EventSeverity::Error, Event::Style, -1, std::string("Failed to load tile 0/0/0=>0 for source mapbox: " + message)))); auto unchecked = flo->unchecked(); diff --git a/test/api/repeated_render.cpp b/test/api/repeated_render.cpp index 3a71ddb08d..cf71cb8416 100644 --- a/test/api/repeated_render.cpp +++ b/test/api/repeated_render.cpp @@ -42,8 +42,8 @@ TEST(API, RepeatedRender) { loop.runOnce(); } - ASSERT_EQ(256, result.width); - ASSERT_EQ(512, result.height); + ASSERT_EQ(256u, result.width); + ASSERT_EQ(512u, result.height); #if !TEST_READ_ONLY util::write_file("test/fixtures/api/1.png", encodePNG(result)); #endif @@ -60,8 +60,8 @@ TEST(API, RepeatedRender) { loop.runOnce(); } - ASSERT_EQ(256, result.width); - ASSERT_EQ(512, result.height); + ASSERT_EQ(256u, result.width); + ASSERT_EQ(512u, result.height); #if !TEST_READ_ONLY util::write_file("test/fixtures/api/2.png", encodePNG(result)); #endif diff --git a/test/api/set_style.cpp b/test/api/set_style.cpp index fb5027c076..2399e4ea50 100644 --- a/test/api/set_style.cpp +++ b/test/api/set_style.cpp @@ -26,7 +26,7 @@ TEST(API, SetStyle) { auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); - EXPECT_EQ(1ul, flo->count({ EventSeverity::Error, Event::ParseStyle, -1, + EXPECT_EQ(1u, flo->count({ EventSeverity::Error, Event::ParseStyle, -1, "Error parsing style JSON at 0: Invalid value." })); auto unchecked = flo->unchecked(); EXPECT_TRUE(unchecked.empty()) << unchecked; diff --git a/test/gl/object.cpp b/test/gl/object.cpp index f2b21ec9f4..a9fd038e61 100644 --- a/test/gl/object.cpp +++ b/test/gl/object.cpp @@ -15,7 +15,7 @@ namespace { static bool getFlag = false; static bool setFlag = false; -}; // namespace +} // namespace struct MockGLObject { using Type = bool; @@ -74,35 +74,35 @@ TEST(GLObject, Store) { EXPECT_TRUE(store.empty()); mbgl::gl::UniqueProgram program = store.createProgram(); - EXPECT_NE(program.get(), 0); + EXPECT_NE(program.get(), 0u); program.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); EXPECT_TRUE(store.empty()); mbgl::gl::UniqueShader shader = store.createShader(GL_VERTEX_SHADER); - EXPECT_NE(shader.get(), 0); + EXPECT_NE(shader.get(), 0u); shader.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); EXPECT_TRUE(store.empty()); mbgl::gl::UniqueBuffer buffer = store.createBuffer(); - EXPECT_NE(buffer.get(), 0); + EXPECT_NE(buffer.get(), 0u); buffer.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); EXPECT_TRUE(store.empty()); mbgl::gl::UniqueTexture texture = store.createTexture(); - EXPECT_NE(texture.get(), 0); + EXPECT_NE(texture.get(), 0u); texture.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); EXPECT_TRUE(store.empty()); mbgl::gl::UniqueVAO vao = store.createVAO(); - EXPECT_NE(vao.get(), 0); + EXPECT_NE(vao.get(), 0u); vao.reset(); EXPECT_FALSE(store.empty()); store.performCleanup(); @@ -110,7 +110,7 @@ TEST(GLObject, Store) { mbgl::gl::UniqueTexturePool texturePool = store.createTexturePool(); for (auto& id : texturePool.get()) { - EXPECT_NE(id, 0); + EXPECT_NE(id, 0u); } EXPECT_TRUE(texturePool.get().size() == size_t(mbgl::gl::TextureMax)); texturePool.reset(); @@ -150,7 +150,7 @@ TEST(GLObject, TexturePool) { // Trigger a new texture pool creation. { mbgl::gl::PooledTexture id = pool.acquireTexture(store); - EXPECT_EQ(id, mbgl::gl::TextureMax + 1); + EXPECT_EQ(id, GLuint(mbgl::gl::TextureMax + 1)); EXPECT_TRUE(store.empty()); id.reset(); @@ -164,7 +164,7 @@ TEST(GLObject, TexturePool) { // First pool is still full, thus creating a new pool. mbgl::gl::PooledTexture id1 = pool.acquireTexture(store); - EXPECT_GT(id1.get(), mbgl::gl::TextureMax); + EXPECT_GT(id1.get(), GLuint(mbgl::gl::TextureMax)); EXPECT_TRUE(store.empty()); // Release all textures from the first pool. diff --git a/test/sprite/sprite_atlas.cpp b/test/sprite/sprite_atlas.cpp index 08b8e54002..d9f96d57d1 100644 --- a/test/sprite/sprite_atlas.cpp +++ b/test/sprite/sprite_atlas.cpp @@ -52,8 +52,8 @@ TEST(Sprite, SpriteAtlas) { EXPECT_EQ(20, metro.pos.h); EXPECT_EQ(18, metro.spriteImage->getWidth()); EXPECT_EQ(18, metro.spriteImage->getHeight()); - EXPECT_EQ(18, metro.spriteImage->image.width); - EXPECT_EQ(18, metro.spriteImage->image.height); + EXPECT_EQ(18u, metro.spriteImage->image.width); + EXPECT_EQ(18u, metro.spriteImage->image.height); EXPECT_EQ(1.0f, metro.spriteImage->pixelRatio); EXPECT_TRUE(atlas.getData()); @@ -108,8 +108,8 @@ TEST(Sprite, SpriteAtlasSize) { EXPECT_EQ(16, metro.pos.h); EXPECT_EQ(18, metro.spriteImage->getWidth()); EXPECT_EQ(18, metro.spriteImage->getHeight()); - EXPECT_EQ(18, metro.spriteImage->image.width); - EXPECT_EQ(18, metro.spriteImage->image.height); + EXPECT_EQ(18u, metro.spriteImage->image.width); + EXPECT_EQ(18u, metro.spriteImage->image.height); EXPECT_EQ(1.0f, metro.spriteImage->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteatlassize.png"), @@ -135,8 +135,8 @@ TEST(Sprite, SpriteAtlasUpdates) { EXPECT_EQ(16, one.pos.h); EXPECT_EQ(16, one.spriteImage->getWidth()); EXPECT_EQ(12, one.spriteImage->getHeight()); - EXPECT_EQ(16, one.spriteImage->image.width); - EXPECT_EQ(12, one.spriteImage->image.height); + EXPECT_EQ(16u, one.spriteImage->image.width); + EXPECT_EQ(12u, one.spriteImage->image.height); EXPECT_EQ(1.0f, one.spriteImage->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteatlas-empty.png"), diff --git a/test/sprite/sprite_image.cpp b/test/sprite/sprite_image.cpp index 29e96cf134..f8982826a3 100644 --- a/test/sprite/sprite_image.cpp +++ b/test/sprite/sprite_image.cpp @@ -40,9 +40,9 @@ TEST(Sprite, SpriteImage) { PremultipliedImage image(32, 24); SpriteImage sprite(std::move(image), 2.0); EXPECT_EQ(16, sprite.getWidth()); - EXPECT_EQ(32, sprite.image.width); + EXPECT_EQ(32u, sprite.image.width); EXPECT_EQ(12, sprite.getHeight()); - EXPECT_EQ(24, sprite.image.height); + EXPECT_EQ(24u, sprite.image.height); EXPECT_EQ(2, sprite.pixelRatio); } @@ -50,8 +50,8 @@ TEST(Sprite, SpriteImageFractionalRatio) { PremultipliedImage image(20, 12); SpriteImage sprite(std::move(image), 1.5); EXPECT_EQ(float(20.0 / 1.5), sprite.getWidth()); - EXPECT_EQ(20, sprite.image.width); + EXPECT_EQ(20u, sprite.image.width); EXPECT_EQ(float(12.0 / 1.5), sprite.getHeight()); - EXPECT_EQ(12, sprite.image.height); + EXPECT_EQ(12u, sprite.image.height); EXPECT_EQ(1.5, sprite.pixelRatio); } diff --git a/test/sprite/sprite_parser.cpp b/test/sprite/sprite_parser.cpp index 318911674e..85a5387898 100644 --- a/test/sprite/sprite_parser.cpp +++ b/test/sprite/sprite_parser.cpp @@ -60,8 +60,8 @@ TEST(Sprite, SpriteImageCreation1x) { ASSERT_TRUE(sprite.get()); EXPECT_EQ(18, sprite->getWidth()); EXPECT_EQ(18, sprite->getHeight()); - EXPECT_EQ(18, sprite->image.width); - EXPECT_EQ(18, sprite->image.height); + EXPECT_EQ(18u, sprite->image.width); + EXPECT_EQ(18u, sprite->image.height); EXPECT_EQ(1, sprite->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteimagecreation1x-museum.png"), sprite->image); @@ -76,8 +76,8 @@ TEST(Sprite, SpriteImageCreation2x) { ASSERT_TRUE(sprite.get()); EXPECT_EQ(18, sprite->getWidth()); EXPECT_EQ(18, sprite->getHeight()); - EXPECT_EQ(36, sprite->image.width); - EXPECT_EQ(36, sprite->image.height); + EXPECT_EQ(36u, sprite->image.width); + EXPECT_EQ(36u, sprite->image.height); EXPECT_EQ(2, sprite->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteimagecreation2x.png"), sprite->image); @@ -91,8 +91,8 @@ TEST(Sprite, SpriteImageCreation1_5x) { ASSERT_TRUE(sprite.get()); EXPECT_EQ(24, sprite->getWidth()); EXPECT_EQ(24, sprite->getHeight()); - EXPECT_EQ(36, sprite->image.width); - EXPECT_EQ(36, sprite->image.height); + EXPECT_EQ(36u, sprite->image.width); + EXPECT_EQ(36u, sprite->image.height); EXPECT_EQ(1.5, sprite->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteimagecreation1_5x-museum.png"), sprite->image); @@ -102,8 +102,8 @@ TEST(Sprite, SpriteImageCreation1_5x) { ASSERT_TRUE(sprite2.get()); EXPECT_EQ(float(35 / 1.5), sprite2->getWidth()); EXPECT_EQ(float(35 / 1.5), sprite2->getHeight()); - EXPECT_EQ(35, sprite2->image.width); - EXPECT_EQ(35, sprite2->image.height); + EXPECT_EQ(35u, sprite2->image.width); + EXPECT_EQ(35u, sprite2->image.height); EXPECT_EQ(1.5, sprite2->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteimagecreation1_5x-hospital.png"), sprite2->image); @@ -198,8 +198,8 @@ TEST(Sprite, SpriteParsing) { auto sprite = images.find("generic-metro")->second; EXPECT_EQ(18, sprite->getWidth()); EXPECT_EQ(18, sprite->getHeight()); - EXPECT_EQ(18, sprite->image.width); - EXPECT_EQ(18, sprite->image.height); + EXPECT_EQ(18u, sprite->image.width); + EXPECT_EQ(18u, sprite->image.height); EXPECT_EQ(1, sprite->pixelRatio); EXPECT_EQ(readImage("test/fixtures/annotations/result-spriteparsing.png"), sprite->image); } diff --git a/test/sprite/sprite_store.cpp b/test/sprite/sprite_store.cpp index 90f1e3b3f1..4c1ddc7934 100644 --- a/test/sprite/sprite_store.cpp +++ b/test/sprite/sprite_store.cpp @@ -181,14 +181,14 @@ Response successfulSpriteImageResponse(const Resource& resource) { Response response; response.data = std::make_shared<std::string>(util::read_file(resource.url)); return response; -}; +} Response successfulSpriteJSONResponse(const Resource& resource) { EXPECT_EQ("test/fixtures/resources/sprite.json", resource.url); Response response; response.data = std::make_shared<std::string>(util::read_file(resource.url)); return response; -}; +} Response failedSpriteResponse(const Resource&) { Response response; @@ -196,13 +196,13 @@ Response failedSpriteResponse(const Resource&) { Response::Error::Reason::Other, "Failed by the test case"); return response; -}; +} Response corruptSpriteResponse(const Resource&) { Response response; response.data = std::make_shared<std::string>("CORRUPT"); return response; -}; +} TEST(SpriteStore, LoadingSuccess) { SpriteStoreTest test; diff --git a/test/storage/headers.cpp b/test/storage/headers.cpp index b879c43b12..b7dcfc025d 100644 --- a/test/storage/headers.cpp +++ b/test/storage/headers.cpp @@ -12,12 +12,12 @@ TEST(HTTPHeader, Parsing) { cc = http::CacheControl::parse(R"#(max-age =34)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(34, *cc.maxAge); + EXPECT_EQ(34u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(,max-age=1)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(1, *cc.maxAge); + EXPECT_EQ(1u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age=-1)#"); @@ -30,12 +30,12 @@ TEST(HTTPHeader, Parsing) { cc = http::CacheControl::parse(R"#(max-age="34,max-age="22,max-age=28)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(28, *cc.maxAge); + EXPECT_EQ(28u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age=3,max-age="34)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(3, *cc.maxAge); + EXPECT_EQ(3u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age="\",max-age=4,")#"); @@ -44,26 +44,26 @@ TEST(HTTPHeader, Parsing) { cc = http::CacheControl::parse(R"#(private, max-age=0, no-cache)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(0, *cc.maxAge); + EXPECT_EQ(0u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age=0, no-cache, no-store)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(0, *cc.maxAge); + EXPECT_EQ(0u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(, private , max-bar=3 , no-cache, "\,",,foo=",",,max-age=32)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(32, *cc.maxAge); + EXPECT_EQ(32u, *cc.maxAge); EXPECT_FALSE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(max-age=3600, must-revalidate)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(3600, *cc.maxAge); + EXPECT_EQ(3600u, *cc.maxAge); EXPECT_TRUE(cc.mustRevalidate); cc = http::CacheControl::parse(R"#(no-cache="Expires,Via",max-age=3600, must-revalidate)#"); ASSERT_TRUE(bool(cc.maxAge)); - EXPECT_EQ(3600, *cc.maxAge); + EXPECT_EQ(3600u, *cc.maxAge); EXPECT_TRUE(cc.mustRevalidate); } diff --git a/test/storage/offline_database.cpp b/test/storage/offline_database.cpp index 0f95e927de..327dd924b2 100644 --- a/test/storage/offline_database.cpp +++ b/test/storage/offline_database.cpp @@ -113,7 +113,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(SchemaVersion)) { auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); - EXPECT_EQ(1ul, flo->count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" })); + EXPECT_EQ(1u, flo->count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" })); } TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Invalid)) { @@ -129,7 +129,7 @@ TEST(OfflineDatabase, TEST_REQUIRES_WRITE(Invalid)) { auto observer = Log::removeObserver(); auto flo = dynamic_cast<FixtureLogObserver*>(observer.get()); - EXPECT_EQ(1ul, flo->count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" })); + EXPECT_EQ(1u, flo->count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" })); } TEST(OfflineDatabase, PutDoesNotStoreConnectionErrors) { @@ -169,7 +169,7 @@ TEST(OfflineDatabase, PutResource) { response.data = std::make_shared<std::string>("first"); auto insertPutResult = db.put(resource, response); EXPECT_TRUE(insertPutResult.first); - EXPECT_EQ(5, insertPutResult.second); + EXPECT_EQ(5u, insertPutResult.second); auto insertGetResult = db.get(resource); EXPECT_EQ(nullptr, insertGetResult->error.get()); @@ -178,7 +178,7 @@ TEST(OfflineDatabase, PutResource) { response.data = std::make_shared<std::string>("second"); auto updatePutResult = db.put(resource, response); EXPECT_FALSE(updatePutResult.first); - EXPECT_EQ(6, updatePutResult.second); + EXPECT_EQ(6u, updatePutResult.second); auto updateGetResult = db.get(resource); EXPECT_EQ(nullptr, updateGetResult->error.get()); @@ -203,7 +203,7 @@ TEST(OfflineDatabase, PutTile) { response.data = std::make_shared<std::string>("first"); auto insertPutResult = db.put(resource, response); EXPECT_TRUE(insertPutResult.first); - EXPECT_EQ(5, insertPutResult.second); + EXPECT_EQ(5u, insertPutResult.second); auto insertGetResult = db.get(resource); EXPECT_EQ(nullptr, insertGetResult->error.get()); @@ -212,7 +212,7 @@ TEST(OfflineDatabase, PutTile) { response.data = std::make_shared<std::string>("second"); auto updatePutResult = db.put(resource, response); EXPECT_FALSE(updatePutResult.first); - EXPECT_EQ(6, updatePutResult.second); + EXPECT_EQ(6u, updatePutResult.second); auto updateGetResult = db.get(resource); EXPECT_EQ(nullptr, updateGetResult->error.get()); @@ -284,7 +284,7 @@ TEST(OfflineDatabase, ListRegions) { OfflineRegion region = db.createRegion(definition, metadata); std::vector<OfflineRegion> regions = db.listRegions(); - ASSERT_EQ(1, regions.size()); + ASSERT_EQ(1u, regions.size()); EXPECT_EQ(region.getID(), regions.at(0).getID()); EXPECT_EQ(definition.styleURL, regions.at(0).getDefinition().styleURL); EXPECT_EQ(definition.bounds, regions.at(0).getDefinition().bounds); @@ -327,7 +327,7 @@ TEST(OfflineDatabase, DeleteRegion) { db.deleteRegion(std::move(region)); - ASSERT_EQ(0, db.listRegions().size()); + ASSERT_EQ(0u, db.listRegions().size()); } TEST(OfflineDatabase, CreateRegionInfiniteMaxZoom) { @@ -391,15 +391,15 @@ TEST(OfflineDatabase, PutReturnsSize) { Response compressible; compressible.data = std::make_shared<std::string>(1024, 0); - EXPECT_EQ(17, db.put(Resource::style("http://example.com/compressible"), compressible).second); + EXPECT_EQ(17u, db.put(Resource::style("http://example.com/compressible"), compressible).second); Response incompressible; incompressible.data = randomString(1024); - EXPECT_EQ(1024, db.put(Resource::style("http://example.com/incompressible"), incompressible).second); + EXPECT_EQ(1024u, db.put(Resource::style("http://example.com/incompressible"), incompressible).second); Response noContent; noContent.noContent = true; - EXPECT_EQ(0, db.put(Resource::style("http://example.com/noContent"), noContent).second); + EXPECT_EQ(0u, db.put(Resource::style("http://example.com/noContent"), noContent).second); } TEST(OfflineDatabase, PutEvictsLeastRecentlyUsedResources) { @@ -458,10 +458,10 @@ TEST(OfflineDatabase, GetRegionCompletedStatus) { OfflineRegion region = db.createRegion(definition, metadata); OfflineRegionStatus status1 = db.getRegionCompletedStatus(region.getID()); - EXPECT_EQ(0, status1.completedResourceCount); - EXPECT_EQ(0, status1.completedResourceSize); - EXPECT_EQ(0, status1.completedTileCount); - EXPECT_EQ(0, status1.completedTileSize); + EXPECT_EQ(0u, status1.completedResourceCount); + EXPECT_EQ(0u, status1.completedResourceSize); + EXPECT_EQ(0u, status1.completedTileCount); + EXPECT_EQ(0u, status1.completedTileSize); Response response; response.data = std::make_shared<std::string>("data"); @@ -469,17 +469,17 @@ TEST(OfflineDatabase, GetRegionCompletedStatus) { uint64_t styleSize = db.putRegionResource(region.getID(), Resource::style("http://example.com/"), response); OfflineRegionStatus status2 = db.getRegionCompletedStatus(region.getID()); - EXPECT_EQ(1, status2.completedResourceCount); + EXPECT_EQ(1u, status2.completedResourceCount); EXPECT_EQ(styleSize, status2.completedResourceSize); - EXPECT_EQ(0, status2.completedTileCount); - EXPECT_EQ(0, status2.completedTileSize); + EXPECT_EQ(0u, status2.completedTileCount); + EXPECT_EQ(0u, status2.completedTileSize); uint64_t tileSize = db.putRegionResource(region.getID(), Resource::tile("http://example.com/", 1.0, 0, 0, 0), response); OfflineRegionStatus status3 = db.getRegionCompletedStatus(region.getID()); - EXPECT_EQ(2, status3.completedResourceCount); + EXPECT_EQ(2u, status3.completedResourceCount); EXPECT_EQ(styleSize + tileSize, status3.completedResourceSize); - EXPECT_EQ(1, status3.completedTileCount); + EXPECT_EQ(1u, status3.completedTileCount); EXPECT_EQ(tileSize, status3.completedTileSize); } @@ -501,43 +501,43 @@ TEST(OfflineDatabase, OfflineMapboxTileCount) { response.data = std::make_shared<std::string>("data"); // Count is initially zero. - EXPECT_EQ(0, db.getOfflineMapboxTileCount()); + EXPECT_EQ(0u, db.getOfflineMapboxTileCount()); // Count stays the same after putting a non-tile resource. db.putRegionResource(region1.getID(), Resource::style("http://example.com/"), response); - EXPECT_EQ(0, db.getOfflineMapboxTileCount()); + EXPECT_EQ(0u, db.getOfflineMapboxTileCount()); // Count stays the same after putting a non-Mapbox tile. db.putRegionResource(region1.getID(), nonMapboxTile, response); - EXPECT_EQ(0, db.getOfflineMapboxTileCount()); + EXPECT_EQ(0u, db.getOfflineMapboxTileCount()); // Count increases after putting a Mapbox tile not used by another region. db.putRegionResource(region1.getID(), mapboxTile1, response); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count stays the same after putting a Mapbox tile used by another region. db.putRegionResource(region2.getID(), mapboxTile1, response); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count stays the same after putting a Mapbox tile used by the same region. db.putRegionResource(region2.getID(), mapboxTile1, response); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count stays the same after deleting a region when the tile is still used by another region. db.deleteRegion(std::move(region2)); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count stays the same after the putting a non-offline Mapbox tile. db.put(mapboxTile2, response); - EXPECT_EQ(1, db.getOfflineMapboxTileCount()); + EXPECT_EQ(1u, db.getOfflineMapboxTileCount()); // Count increases after putting a pre-existing, but non-offline Mapbox tile. db.putRegionResource(region1.getID(), mapboxTile2, response); - EXPECT_EQ(2, db.getOfflineMapboxTileCount()); + EXPECT_EQ(2u, db.getOfflineMapboxTileCount()); // Count decreases after deleting a region when the tiles are not used by other regions. db.deleteRegion(std::move(region1)); - EXPECT_EQ(0, db.getOfflineMapboxTileCount()); + EXPECT_EQ(0u, db.getOfflineMapboxTileCount()); } static int databasePageCount(const std::string& path) { diff --git a/test/storage/offline_download.cpp b/test/storage/offline_download.cpp index 7ac9b94e81..07218edaff 100644 --- a/test/storage/offline_download.cpp +++ b/test/storage/offline_download.cpp @@ -77,12 +77,12 @@ TEST(OfflineDownload, NoSubresources) { if (!expectsInactiveStatus) { expectsInactiveStatus = true; EXPECT_EQ(OfflineRegionDownloadState::Active, status.downloadState); - EXPECT_EQ(1, status.completedResourceCount); + EXPECT_EQ(1u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); } else { EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); - EXPECT_EQ(1, status.completedResourceCount); + EXPECT_EQ(1u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); test.loop.stop(); @@ -123,7 +123,7 @@ TEST(OfflineDownload, InlineSource) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(2, status.completedResourceCount); + EXPECT_EQ(2u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); test.loop.stop(); @@ -158,7 +158,7 @@ TEST(OfflineDownload, GeoJSONSource) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(2, status.completedResourceCount); + EXPECT_EQ(2u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); test.loop.stop(); @@ -217,7 +217,7 @@ TEST(OfflineDownload, Activate) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(261, status.completedResourceCount); // 256 glyphs, 1 tile, 1 style, source, sprite image, and sprite json + EXPECT_EQ(261u, status.completedResourceCount); // 256 glyphs, 1 tile, 1 style, source, sprite image, and sprite json EXPECT_EQ(test.size, status.completedResourceSize); download.setState(OfflineRegionDownloadState::Inactive); @@ -248,9 +248,9 @@ TEST(OfflineDownload, GetStatusNoResources) { OfflineRegionStatus status = download.getStatus(); EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); - EXPECT_EQ(0, status.completedResourceCount); - EXPECT_EQ(0, status.completedResourceSize); - EXPECT_EQ(1, status.requiredResourceCount); + EXPECT_EQ(0u, status.completedResourceCount); + EXPECT_EQ(0u, status.completedResourceSize); + EXPECT_EQ(1u, status.requiredResourceCount); EXPECT_FALSE(status.requiredResourceCountIsPrecise); EXPECT_FALSE(status.complete()); } @@ -270,9 +270,9 @@ TEST(OfflineDownload, GetStatusStyleComplete) { OfflineRegionStatus status = download.getStatus(); EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); - EXPECT_EQ(1, status.completedResourceCount); + EXPECT_EQ(1u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); - EXPECT_EQ(260, status.requiredResourceCount); + EXPECT_EQ(260u, status.requiredResourceCount); EXPECT_FALSE(status.requiredResourceCountIsPrecise); EXPECT_FALSE(status.complete()); } @@ -296,9 +296,9 @@ TEST(OfflineDownload, GetStatusStyleAndSourceComplete) { OfflineRegionStatus status = download.getStatus(); EXPECT_EQ(OfflineRegionDownloadState::Inactive, status.downloadState); - EXPECT_EQ(2, status.completedResourceCount); + EXPECT_EQ(2u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); - EXPECT_EQ(261, status.requiredResourceCount); + EXPECT_EQ(261u, status.requiredResourceCount); EXPECT_TRUE(status.requiredResourceCountIsPrecise); EXPECT_FALSE(status.complete()); } @@ -353,7 +353,7 @@ TEST(OfflineDownload, RequestErrorsAreRetried) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(1, status.completedResourceCount); + EXPECT_EQ(1u, status.completedResourceCount); test.loop.stop(); } }; @@ -391,7 +391,7 @@ TEST(OfflineDownload, TileCountLimitExceededNoTileResponse) { }; observer->statusChangedFn = [&] (OfflineRegionStatus status) { - if (!mapboxTileCountLimitExceededCalled) { + if (!mapboxTileCountLimitExceededCalled) { EXPECT_FALSE(status.complete()); EXPECT_EQ(OfflineRegionDownloadState::Active, status.downloadState); } else { @@ -422,7 +422,7 @@ TEST(OfflineDownload, TileCountLimitExceededWithTileResponse) { EXPECT_EQ("http://127.0.0.1:3000/style.json", resource.url); return test.response("mapbox_source.style.json"); }; - + test.fileSource.tileResponse = [&] (const Resource& resource) { const Resource::TileData& tile = *resource.tileData; EXPECT_EQ("mapbox://{z}-{x}-{y}.vector.pbf", tile.urlTemplate); @@ -442,7 +442,7 @@ TEST(OfflineDownload, TileCountLimitExceededWithTileResponse) { mapboxTileCountLimitExceededCalled = true; }; - observer->statusChangedFn = [&] (OfflineRegionStatus status) { + observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (!mapboxTileCountLimitExceededCalled) { EXPECT_EQ(OfflineRegionDownloadState::Active, status.downloadState); } else { @@ -481,7 +481,7 @@ TEST(OfflineDownload, WithPreviouslyExistingTile) { observer->statusChangedFn = [&] (OfflineRegionStatus status) { if (status.complete()) { - EXPECT_EQ(2, status.completedResourceCount); + EXPECT_EQ(2u, status.completedResourceCount); EXPECT_EQ(test.size, status.completedResourceSize); EXPECT_TRUE(status.requiredResourceCountIsPrecise); test.loop.stop(); @@ -543,22 +543,22 @@ TEST(OfflineDownload, ReactivatePreviouslyCompletedDownload) { test.loop.run(); - ASSERT_EQ(4, statusesAfterReactivate.size()); + ASSERT_EQ(4u, statusesAfterReactivate.size()); EXPECT_EQ(OfflineRegionDownloadState::Active, statusesAfterReactivate[0].downloadState); EXPECT_FALSE(statusesAfterReactivate[0].requiredResourceCountIsPrecise); - EXPECT_EQ(1, statusesAfterReactivate[0].requiredResourceCount); - EXPECT_EQ(0, statusesAfterReactivate[0].completedResourceCount); + EXPECT_EQ(1u, statusesAfterReactivate[0].requiredResourceCount); + EXPECT_EQ(0u, statusesAfterReactivate[0].completedResourceCount); EXPECT_EQ(OfflineRegionDownloadState::Active, statusesAfterReactivate[1].downloadState); EXPECT_TRUE(statusesAfterReactivate[1].requiredResourceCountIsPrecise); - EXPECT_EQ(2, statusesAfterReactivate[1].requiredResourceCount); - EXPECT_EQ(1, statusesAfterReactivate[1].completedResourceCount); + EXPECT_EQ(2u, statusesAfterReactivate[1].requiredResourceCount); + EXPECT_EQ(1u, statusesAfterReactivate[1].completedResourceCount); EXPECT_EQ(OfflineRegionDownloadState::Active, statusesAfterReactivate[2].downloadState); EXPECT_TRUE(statusesAfterReactivate[2].requiredResourceCountIsPrecise); - EXPECT_EQ(2, statusesAfterReactivate[2].requiredResourceCount); - EXPECT_EQ(2, statusesAfterReactivate[2].completedResourceCount); + EXPECT_EQ(2u, statusesAfterReactivate[2].requiredResourceCount); + EXPECT_EQ(2u, statusesAfterReactivate[2].completedResourceCount); } TEST(OfflineDownload, Deactivate) { diff --git a/test/style/filter.cpp b/test/style/filter.cpp index 6e7f62db1b..c013c36cd1 100644 --- a/test/style/filter.cpp +++ b/test/style/filter.cpp @@ -57,7 +57,7 @@ TEST(Filter, EqualsString) { Filter f = parse("[\"==\", \"foo\", \"bar\"]"); ASSERT_TRUE(evaluate(f, {{ "foo", std::string("bar") }})); ASSERT_FALSE(evaluate(f, {{ "foo", std::string("baz") }})); -}; +} TEST(Filter, EqualsNumber) { Filter f = parse("[\"==\", \"foo\", 0]"); diff --git a/test/style/style_parser.cpp b/test/style/style_parser.cpp index 5f730a8373..7f8e534cf4 100644 --- a/test/style/style_parser.cpp +++ b/test/style/style_parser.cpp @@ -61,7 +61,7 @@ TEST_P(StyleParserTest, ParseStyle) { std::cerr << "Unchecked Log Messages (" << base << "/" << name << "): " << std::endl << unchecked; } - ASSERT_EQ(0ul, unchecked.size()); + ASSERT_EQ(0u, unchecked.size()); } } @@ -81,7 +81,7 @@ INSTANTIATE_TEST_CASE_P(StyleParser, StyleParserTest, ::testing::ValuesIn([] { closedir(dir); } - EXPECT_GT(names.size(), 0ul); + EXPECT_GT(names.size(), 0u); return names; }())); @@ -119,7 +119,7 @@ TEST(StyleParser, FontStacks) { style::Parser parser; parser.parse(util::read_file("test/fixtures/style_parser/font_stacks.json")); auto result = parser.fontStacks(); - ASSERT_EQ(3, result.size()); + ASSERT_EQ(3u, result.size()); ASSERT_EQ(FontStack({"a"}), result[0]); ASSERT_EQ(FontStack({"a", "b"}), result[1]); ASSERT_EQ(FontStack({"a", "b", "c"}), result[2]); diff --git a/test/tile/geometry_tile.cpp b/test/tile/geometry_tile.cpp index c94b20cee6..998a7183a7 100644 --- a/test/tile/geometry_tile.cpp +++ b/test/tile/geometry_tile.cpp @@ -9,9 +9,9 @@ TEST(GeometryTile, classifyRings1) { }); // output: 1 polygon - ASSERT_EQ(polygons.size(), 1); + ASSERT_EQ(polygons.size(), 1u); // output: polygon 1 has 1 exterior - ASSERT_EQ(polygons[0].size(), 1); + ASSERT_EQ(polygons[0].size(), 1u); } TEST(GeometryTile, classifyRings2) { @@ -21,9 +21,9 @@ TEST(GeometryTile, classifyRings2) { }); // output: 1 polygon - ASSERT_EQ(polygons.size(), 1); + ASSERT_EQ(polygons.size(), 1u); // output: polygon 1 has 1 exterior, 1 interior - ASSERT_EQ(polygons[0].size(), 2); + ASSERT_EQ(polygons[0].size(), 2u); } TEST(GeometryTile, limitHoles1) { @@ -36,7 +36,7 @@ TEST(GeometryTile, limitHoles1) { limitHoles(polygon, 1); // output: polygon 1 has 1 exterior, 1 interior - ASSERT_EQ(polygon.size(), 2); + ASSERT_EQ(polygon.size(), 2u); // ensure we've kept the right rings (ones with largest areas) ASSERT_EQ(polygon[0][0].x, 0); @@ -53,7 +53,7 @@ TEST(GeometryTile, limitHoles2) { limitHoles(polygon, 1); // output: polygon 1 has 1 exterior, 1 interior - ASSERT_EQ(polygon.size(), 2); + ASSERT_EQ(polygon.size(), 2u); // ensure we've kept the right rings (ones with largest areas) ASSERT_EQ(polygon[0][0].x, 0); diff --git a/test/tile/tile_id.cpp b/test/tile/tile_id.cpp index e5a1403d20..1ef19fea0e 100644 --- a/test/tile/tile_id.cpp +++ b/test/tile/tile_id.cpp @@ -6,9 +6,9 @@ using namespace mbgl; TEST(TileID, Canonical) { CanonicalTileID id_0_0_0(0, 0, 0); - EXPECT_EQ(0, id_0_0_0.z); - EXPECT_EQ(0, id_0_0_0.x); - EXPECT_EQ(0, id_0_0_0.y); + EXPECT_EQ(0u, id_0_0_0.z); + EXPECT_EQ(0u, id_0_0_0.x); + EXPECT_EQ(0u, id_0_0_0.y); EXPECT_TRUE(CanonicalTileID(4, 2, 3) == CanonicalTileID(4, 2, 3)); EXPECT_FALSE(CanonicalTileID(4, 2, 3) != CanonicalTileID(4, 2, 3)); @@ -157,11 +157,11 @@ TEST(TileID, Overscaled) { EXPECT_TRUE(OverscaledTileID(4, 2, 3) < OverscaledTileID(7, { 4, 2, 3 })); EXPECT_FALSE(OverscaledTileID(7, { 4, 2, 3 }) < OverscaledTileID(4, 2, 3)); - EXPECT_EQ(8, OverscaledTileID(7, { 4, 2, 3 }).overscaleFactor()); - EXPECT_EQ(4, OverscaledTileID(6, { 4, 2, 3 }).overscaleFactor()); - EXPECT_EQ(2, OverscaledTileID(5, { 4, 2, 3 }).overscaleFactor()); - EXPECT_EQ(1, OverscaledTileID(4, { 4, 2, 3 }).overscaleFactor()); - EXPECT_EQ(2147483648, OverscaledTileID(31, { 0, 0, 0 }).overscaleFactor()); + EXPECT_EQ(8u, OverscaledTileID(7, { 4, 2, 3 }).overscaleFactor()); + EXPECT_EQ(4u, OverscaledTileID(6, { 4, 2, 3 }).overscaleFactor()); + EXPECT_EQ(2u, OverscaledTileID(5, { 4, 2, 3 }).overscaleFactor()); + EXPECT_EQ(1u, OverscaledTileID(4, { 4, 2, 3 }).overscaleFactor()); + EXPECT_EQ(2147483648u, OverscaledTileID(31, { 0, 0, 0 }).overscaleFactor()); EXPECT_EQ(OverscaledTileID(0, { 0, 0, 0 }), OverscaledTileID(4, 2, 3).scaledTo(0)); EXPECT_EQ(OverscaledTileID(1, { 1, 0, 0 }), OverscaledTileID(4, 2, 3).scaledTo(1)); @@ -214,58 +214,58 @@ TEST(TileID, Overscaled) { TEST(TileID, Unwrapped) { UnwrappedTileID id_0_0_0(0, 0, 0); - EXPECT_EQ(0, id_0_0_0.canonical.z); - EXPECT_EQ(0, id_0_0_0.canonical.x); - EXPECT_EQ(0, id_0_0_0.canonical.y); + EXPECT_EQ(0u, id_0_0_0.canonical.z); + EXPECT_EQ(0u, id_0_0_0.canonical.x); + EXPECT_EQ(0u, id_0_0_0.canonical.y); EXPECT_EQ(0, id_0_0_0.wrap); UnwrappedTileID id_0_1_0(0, 1, 0); - EXPECT_EQ(0, id_0_1_0.canonical.z); - EXPECT_EQ(0, id_0_1_0.canonical.x); - EXPECT_EQ(0, id_0_1_0.canonical.y); + EXPECT_EQ(0u, id_0_1_0.canonical.z); + EXPECT_EQ(0u, id_0_1_0.canonical.x); + EXPECT_EQ(0u, id_0_1_0.canonical.y); EXPECT_EQ(1, id_0_1_0.wrap); UnwrappedTileID id_0_4_0(0, 4, 0); - EXPECT_EQ(0, id_0_4_0.canonical.z); - EXPECT_EQ(0, id_0_4_0.canonical.x); - EXPECT_EQ(0, id_0_4_0.canonical.y); + EXPECT_EQ(0u, id_0_4_0.canonical.z); + EXPECT_EQ(0u, id_0_4_0.canonical.x); + EXPECT_EQ(0u, id_0_4_0.canonical.y); EXPECT_EQ(4, id_0_4_0.wrap); UnwrappedTileID id_0_n1_0(0, -1, 0); - EXPECT_EQ(0, id_0_n1_0.canonical.z); - EXPECT_EQ(0, id_0_n1_0.canonical.x); - EXPECT_EQ(0, id_0_n1_0.canonical.y); + EXPECT_EQ(0u, id_0_n1_0.canonical.z); + EXPECT_EQ(0u, id_0_n1_0.canonical.x); + EXPECT_EQ(0u, id_0_n1_0.canonical.y); EXPECT_EQ(-1, id_0_n1_0.wrap); UnwrappedTileID id_0_0_1(0, 0, 1); - EXPECT_EQ(0, id_0_0_1.canonical.z); - EXPECT_EQ(0, id_0_0_1.canonical.x); - EXPECT_EQ(0, id_0_0_1.canonical.y); + EXPECT_EQ(0u, id_0_0_1.canonical.z); + EXPECT_EQ(0u, id_0_0_1.canonical.x); + EXPECT_EQ(0u, id_0_0_1.canonical.y); EXPECT_EQ(0, id_0_0_1.wrap); UnwrappedTileID id_0_0_n1(0, 0, -1); - EXPECT_EQ(0, id_0_0_n1.canonical.z); - EXPECT_EQ(0, id_0_0_n1.canonical.x); - EXPECT_EQ(0, id_0_0_n1.canonical.y); + EXPECT_EQ(0u, id_0_0_n1.canonical.z); + EXPECT_EQ(0u, id_0_0_n1.canonical.x); + EXPECT_EQ(0u, id_0_0_n1.canonical.y); EXPECT_EQ(0, id_0_0_n1.wrap); UnwrappedTileID id_18_262143_0(18, 262143, 0); - EXPECT_EQ(18, id_18_262143_0.canonical.z); - EXPECT_EQ(262143, id_18_262143_0.canonical.x); - EXPECT_EQ(0, id_18_262143_0.canonical.y); + EXPECT_EQ(18u, id_18_262143_0.canonical.z); + EXPECT_EQ(262143u, id_18_262143_0.canonical.x); + EXPECT_EQ(0u, id_18_262143_0.canonical.y); EXPECT_EQ(0, id_18_262143_0.wrap); UnwrappedTileID id_18_262144_0(18, 262144, 0); - EXPECT_EQ(18, id_18_262144_0.canonical.z); - EXPECT_EQ(0, id_18_262144_0.canonical.x); - EXPECT_EQ(0, id_18_262144_0.canonical.y); + EXPECT_EQ(18u, id_18_262144_0.canonical.z); + EXPECT_EQ(0u, id_18_262144_0.canonical.x); + EXPECT_EQ(0u, id_18_262144_0.canonical.y); EXPECT_EQ(1, id_18_262144_0.wrap); UnwrappedTileID a(2, 4, 3); UnwrappedTileID b(a); - EXPECT_EQ(2, b.canonical.z); - EXPECT_EQ(0, b.canonical.x); - EXPECT_EQ(3, b.canonical.y); + EXPECT_EQ(2u, b.canonical.z); + EXPECT_EQ(0u, b.canonical.x); + EXPECT_EQ(3u, b.canonical.y); EXPECT_EQ(1, b.wrap); EXPECT_TRUE(UnwrappedTileID(0, 0, 0) < UnwrappedTileID(1, 0, 0)); diff --git a/test/util/async_task.cpp b/test/util/async_task.cpp index ad65bfad78..78dc79dd19 100644 --- a/test/util/async_task.cpp +++ b/test/util/async_task.cpp @@ -49,7 +49,7 @@ TEST(AsyncTask, RequestCoalescing) { loop.runOnce(); - EXPECT_EQ(count, 1); + EXPECT_EQ(count, 1u); } TEST(AsyncTask, DestroyShouldNotRunQueue) { @@ -61,7 +61,7 @@ TEST(AsyncTask, DestroyShouldNotRunQueue) { async->send(); async.reset(); - EXPECT_EQ(count, 0); + EXPECT_EQ(count, 0u); } TEST(AsyncTask, DestroyAfterSignaling) { @@ -114,7 +114,7 @@ TEST(AsyncTask, RequestCoalescingMultithreaded) { loop.runOnce(); - EXPECT_EQ(count, 1); + EXPECT_EQ(count, 1u); } TEST(AsyncTask, ThreadSafety) { @@ -149,5 +149,5 @@ TEST(AsyncTask, ThreadSafety) { // We expect here more than 1 but 1 would also be // a valid result, although very unlikely (I hope). - EXPECT_GT(count, 0); + EXPECT_GT(count, 0u); } diff --git a/test/util/image.cpp b/test/util/image.cpp index 67a79cf9dd..b2814e66da 100644 --- a/test/util/image.cpp +++ b/test/util/image.cpp @@ -68,21 +68,21 @@ TEST(Image, PNGReadProfileAlpha) { TEST(Image, PNGTile) { PremultipliedImage image = decodeImage(util::read_file("test/fixtures/image/tile.png")); - EXPECT_EQ(256, image.width); - EXPECT_EQ(256, image.height); + EXPECT_EQ(256u, image.width); + EXPECT_EQ(256u, image.height); } TEST(Image, JPEGTile) { PremultipliedImage image = decodeImage(util::read_file("test/fixtures/image/tile.jpeg")); - EXPECT_EQ(256, image.width); - EXPECT_EQ(256, image.height); + EXPECT_EQ(256u, image.width); + EXPECT_EQ(256u, image.height); } #if !defined(__ANDROID__) && !defined(__APPLE__) && !defined(QT_IMAGE_DECODERS) TEST(Image, WebPTile) { PremultipliedImage image = decodeImage(util::read_file("test/fixtures/image/tile.webp")); - EXPECT_EQ(256, image.width); - EXPECT_EQ(256, image.height); + EXPECT_EQ(256u, image.width); + EXPECT_EQ(256u, image.height); } #endif // !defined(__ANDROID__) && !defined(__APPLE__) && !defined(QT_IMAGE_DECODERS) diff --git a/test/util/thread_local.cpp b/test/util/thread_local.cpp index 074af2c5d0..5233a1806f 100644 --- a/test/util/thread_local.cpp +++ b/test/util/thread_local.cpp @@ -91,5 +91,5 @@ TEST(ThreadLocalStorage, AutoReclaim) { thread1.reset(); thread2.reset(); - EXPECT_EQ(counter, 2); + EXPECT_EQ(counter, 2u); } |