diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-10-22 10:45:42 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-10-22 11:00:34 +0200 |
commit | 2f3952b30541d5bbb3579c39a36052c02b47b37a (patch) | |
tree | c6376f8ec6e386f29578b39c4da5a5c822086153 /test | |
parent | b9d422ebc3d48ff91e8f2eda071a0596ada36233 (diff) | |
download | qtlocation-mapboxgl-2f3952b30541d5bbb3579c39a36052c02b47b37a.tar.gz |
fix compile warnings
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/fixture_request.cpp | 14 | ||||
-rw-r--r-- | test/headless.cpp | 16 | ||||
-rw-r--r-- | test/test.gyp | 32 |
3 files changed, 18 insertions, 44 deletions
diff --git a/test/fixtures/fixture_request.cpp b/test/fixtures/fixture_request.cpp index 3f72b890db..9d2971c73e 100644 --- a/test/fixtures/fixture_request.cpp +++ b/test/fixtures/fixture_request.cpp @@ -35,11 +35,17 @@ void HTTPRequestBaton::start(const util::ptr<HTTPRequestBaton> &baton) { const size_t size = ftell(file); fseek(file, 0, SEEK_SET); baton->response->data.resize(size); - fread(&baton->response->data[0], size, 1, file); + const size_t read = fread(&baton->response->data[0], 1, size, file); fclose(file); - baton->response->code = 200; - baton->type = HTTPResponseType::Successful; + if (read == size) { + baton->response->code = 200; + baton->type = HTTPResponseType::Successful; + } else { + baton->response->code = 500; + baton->type = HTTPResponseType::PermanentError; + baton->response->message = "Read bytes differed from file size"; + } } else { baton->type = HTTPResponseType::PermanentError; baton->response->code = 404; @@ -48,7 +54,7 @@ void HTTPRequestBaton::start(const util::ptr<HTTPRequestBaton> &baton) { uv_async_send(baton->async); } -void HTTPRequestBaton::stop(const util::ptr<HTTPRequestBaton> &baton) { +void HTTPRequestBaton::stop(const util::ptr<HTTPRequestBaton> &) { fprintf(stderr, "HTTP request cannot be canceled because it is answered immediately"); abort(); } diff --git a/test/headless.cpp b/test/headless.cpp index 3cc2607e47..3255cff062 100644 --- a/test/headless.cpp +++ b/test/headless.cpp @@ -35,8 +35,8 @@ TEST_P(HeadlessTest, render) { // Parse style. rapidjson::Document styleDoc; styleDoc.Parse<0>((const char *const)style.c_str()); - ASSERT_EQ(false, styleDoc.HasParseError()); - ASSERT_EQ(true, styleDoc.IsObject()); + ASSERT_FALSE(styleDoc.HasParseError()); + ASSERT_TRUE(styleDoc.IsObject()); rapidjson::StringBuffer buffer; rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); @@ -46,16 +46,16 @@ TEST_P(HeadlessTest, render) { // Parse settings. rapidjson::Document infoDoc; infoDoc.Parse<0>((const char *const)info.c_str()); - ASSERT_EQ(false, infoDoc.HasParseError()); - ASSERT_EQ(true, infoDoc.IsObject()); + ASSERT_FALSE(infoDoc.HasParseError()); + ASSERT_TRUE(infoDoc.IsObject()); Log::Set<FixtureLogBackend>(); for (auto it = infoDoc.MemberBegin(), end = infoDoc.MemberEnd(); it != end; it++) { const std::string name { it->name.GetString(), it->name.GetStringLength() }; const rapidjson::Value &value = it->value; - ASSERT_EQ(true, value.IsObject()); - if (value.HasMember("center")) ASSERT_EQ(true, value["center"].IsArray()); + ASSERT_TRUE(value.IsObject()); + if (value.HasMember("center")) ASSERT_TRUE(value["center"].IsArray()); const std::string actual_image = base_directory + "tests/" + base + "/" + name + "/actual.png"; @@ -70,10 +70,10 @@ TEST_P(HeadlessTest, render) { std::vector<std::string> classes; if (value.HasMember("classes")) { const rapidjson::Value &js_classes = value["classes"]; - ASSERT_EQ(true, js_classes.IsArray()); + ASSERT_TRUE(js_classes.IsArray()); for (rapidjson::SizeType i = 0; i < js_classes.Size(); i++) { const rapidjson::Value &js_class = js_classes[i]; - ASSERT_EQ(true, js_class.IsString()); + ASSERT_TRUE(js_class.IsString()); classes.push_back({ js_class.GetString(), js_class.GetStringLength() }); } } diff --git a/test/test.gyp b/test/test.gyp index bd13ad7fd2..1f63756e71 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -10,11 +10,6 @@ 'direct_dependent_settings': { 'conditions': [ ['OS == "mac"', { - 'link_settings': { - 'libraries': [ - '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW - ], - }, 'xcode_settings': { 'OTHER_LDFLAGS': [ '<@(glfw3_libraries)', # This is a hack since we're not actually using GLFW @@ -62,9 +57,6 @@ "target_name": "rotation_range", "product_name": "test_rotation_range", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./rotation_range.cpp", @@ -78,9 +70,6 @@ "target_name": "clip_ids", "product_name": "test_clip_ids", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./clip_ids.cpp", @@ -94,9 +83,6 @@ "target_name": "enums", "product_name": "test_enums", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./enums.cpp", @@ -110,9 +96,6 @@ "target_name": "style_parser", "product_name": "test_style_parser", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./style_parser.cpp", @@ -129,9 +112,6 @@ "target_name": "variant", "product_name": "test_variant", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./variant.cpp", @@ -145,9 +125,6 @@ "target_name": "comparisons", "product_name": "test_comparisons", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./comparisons.cpp", @@ -161,9 +138,6 @@ "target_name": "tile", "product_name": "test_tile", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./tile.cpp", @@ -177,9 +151,6 @@ "target_name": "functions", "product_name": "test_functions", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./functions.cpp", @@ -193,9 +164,6 @@ "target_name": "headless", "product_name": "test_headless", "type": "executable", - "libraries": [ - "-lpthread", - ], "sources": [ "./main.cpp", "./headless.cpp", |