🚨 add new CI and fix warnings (#2561)

* ⚗️ move CI targets to CMake
* ♻️ add target for cpplint
* ♻️ add target for self-contained binaries
* ♻️ add targets for iwyu and infer
* 🔊 add version output
* ♻️ add target for oclint
* 🚨 fix warnings
* ♻️ rename targets
* ♻️ use iwyu properly
* 🚨 fix warnings
* ♻️ use iwyu properly
* ♻️ add target for benchmarks
* ♻️ add target for CMake flags
* 👷 use GitHub Actions
* ⚗️ try to install Clang 11
* ⚗️ try to install GCC 11
* ⚗️ try to install Clang 11
* ⚗️ try to install GCC 11
* ⚗️ add clang analyze target
* 🔥 remove Google Benchmark
* ⬆️ Google Benchmark 1.5.2
* 🔥 use fetchcontent
* 🐧 add target to download a Linux version of CMake
* 🔨 fix dependency
* 🚨 fix includes
* 🚨 fix comment
* 🔧 adjust flags for GCC 11.0.0 20210110 (experimental)
* 🐳 user Docker image to run CI
* 🔧 add target for Valgrind
* 👷 add target for Valgrind tests
* ⚗️ add Dart
*  remove Dart
* ⚗️ do not call ctest in test subdirectory
* ⚗️ download test data explicitly
* ⚗️ only execute Valgrind tests
* ⚗️ fix labels
* 🔥 remove unneeded jobs
* 🔨 cleanup
* 🐛 fix OCLint call
*  add targets for offline and git-independent tests
*  add targets for C++ language versions and reproducible tests
* 🔨 clean up
* 👷 add CI steps for cppcheck and cpplint
* 🚨 fix warnings from Clang-Tidy
* 👷 add CI steps for Clang-Tidy
* 🚨 fix warnings
* 🔧 select proper binary
* 🚨 fix warnings
* 🚨 suppress some unhelpful warnings
* 🚨 fix warnings
* 🎨 fix format
* 🚨 fix warnings
* 👷 add CI steps for Sanitizers
* 🚨 fix warnings
*  add optimization to sanitizer build
* 🚨 fix warnings
* 🚨 add missing header
* 🚨 fix warnings
* 👷 add CI step for coverage
* 👷 add CI steps for disabled exceptions and implicit conversions
* 🚨 fix warnings
* 👷 add CI steps for checking indentation
* 🐛 fix variable use
* 💚 fix build
*  remove CircleCI
* 👷 add CI step for diagnostics
* 🚨 fix warning
* 🔥 clean Travis
This commit is contained in:
Niels Lohmann
2021-03-24 07:15:18 +01:00
committed by GitHub
parent 6b74772fe8
commit 6f551930e5
152 changed files with 2494 additions and 12148 deletions

View File

@@ -436,7 +436,7 @@ TEST_CASE("constructors")
SECTION("char[]")
{
char s[] {"Hello world"};
char s[] {"Hello world"}; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
json j(s);
CHECK(j.type() == json::value_t::string);
CHECK(j == j_reference);
@@ -794,7 +794,7 @@ TEST_CASE("constructors")
SECTION("integer literal with l suffix")
{
json j(42l);
json j(42L);
CHECK(j.type() == json::value_t::number_integer);
CHECK(j == j_reference);
}
@@ -808,7 +808,7 @@ TEST_CASE("constructors")
SECTION("integer literal with ll suffix")
{
json j(42ll);
json j(42LL);
CHECK(j.type() == json::value_t::number_integer);
CHECK(j == j_reference);
}
@@ -892,7 +892,7 @@ TEST_CASE("constructors")
SECTION("long double")
{
long double n = 42.23l;
long double n = 42.23L;
json j(n);
CHECK(j.type() == json::value_t::number_float);
CHECK(j.m_value.number_float == Approx(j_reference.m_value.number_float));
@@ -914,7 +914,7 @@ TEST_CASE("constructors")
SECTION("integer literal with l suffix")
{
json j(42.23l);
json j(42.23L);
CHECK(j.type() == json::value_t::number_float);
CHECK(j.m_value.number_float == Approx(j_reference.m_value.number_float));
}
@@ -1115,84 +1115,113 @@ TEST_CASE("constructors")
{
SECTION("string")
{
// This should break through any short string optimization in std::string
std::string source(1024, '!');
const char* source_addr = source.data();
SECTION("constructor with implicit types (array)")
{
// This should break through any short string optimization in std::string
std::string source(1024, '!');
const auto* source_addr = source.data();
json j = {std::move(source)};
CHECK(j[0].get_ref<std::string const&>().data() == source_addr);
const auto* target_addr = j[0].get_ref<std::string const&>().data();
const bool success = (target_addr == source_addr);
CHECK(success);
}
SECTION("constructor with implicit types (object)")
{
// This should break through any short string optimization in std::string
std::string source(1024, '!');
const auto* source_addr = source.data();
json j = {{"key", std::move(source)}};
CHECK(j["key"].get_ref<std::string const&>().data() == source_addr);
const auto* target_addr = j["key"].get_ref<std::string const&>().data();
const bool success = (target_addr == source_addr);
CHECK(success);
}
SECTION("constructor with implicit types (object key)")
{
// This should break through any short string optimization in std::string
std::string source(1024, '!');
const auto* source_addr = source.data();
json j = {{std::move(source), 42}};
CHECK(j.get_ref<json::object_t&>().begin()->first.data() == source_addr);
const auto* target_addr = j.get_ref<json::object_t&>().begin()->first.data();
const bool success = (target_addr == source_addr);
CHECK(success);
}
}
SECTION("array")
{
json::array_t source = {1, 2, 3};
const json* source_addr = source.data();
SECTION("constructor with implicit types (array)")
{
json::array_t source = {1, 2, 3};
const auto* source_addr = source.data();
json j {std::move(source)};
CHECK(j[0].get_ref<json::array_t const&>().data() == source_addr);
const auto* target_addr = j[0].get_ref<json::array_t const&>().data();
const bool success = (target_addr == source_addr);
CHECK(success);
}
SECTION("constructor with implicit types (object)")
{
json::array_t source = {1, 2, 3};
const auto* source_addr = source.data();
json j {{"key", std::move(source)}};
CHECK(j["key"].get_ref<json::array_t const&>().data() == source_addr);
const auto* target_addr = j["key"].get_ref<json::array_t const&>().data();
const bool success = (target_addr == source_addr);
CHECK(success);
}
SECTION("assignment with implicit types (array)")
{
json::array_t source = {1, 2, 3};
const auto* source_addr = source.data();
json j = {std::move(source)};
CHECK(j[0].get_ref<json::array_t const&>().data() == source_addr);
const auto* target_addr = j[0].get_ref<json::array_t const&>().data();
const bool success = (target_addr == source_addr);
CHECK(success);
}
SECTION("assignment with implicit types (object)")
{
json::array_t source = {1, 2, 3};
const auto* source_addr = source.data();
json j = {{"key", std::move(source)}};
CHECK(j["key"].get_ref<json::array_t const&>().data() == source_addr);
const auto* target_addr = j["key"].get_ref<json::array_t const&>().data();
const bool success = (target_addr == source_addr);
CHECK(success);
}
}
SECTION("object")
{
json::object_t source = {{"hello", "world"}};
const json* source_addr = &source.at("hello");
SECTION("constructor with implicit types (array)")
{
json::object_t source = {{"hello", "world"}};
const json* source_addr = &source.at("hello");
json j {std::move(source)};
CHECK(&(j[0].get_ref<json::object_t const&>().at("hello")) == source_addr);
}
SECTION("constructor with implicit types (object)")
{
json::object_t source = {{"hello", "world"}};
const json* source_addr = &source.at("hello");
json j {{"key", std::move(source)}};
CHECK(&(j["key"].get_ref<json::object_t const&>().at("hello")) == source_addr);
}
SECTION("assignment with implicit types (array)")
{
json::object_t source = {{"hello", "world"}};
const json* source_addr = &source.at("hello");
json j = {std::move(source)};
CHECK(&(j[0].get_ref<json::object_t const&>().at("hello")) == source_addr);
}
SECTION("assignment with implicit types (object)")
{
json::object_t source = {{"hello", "world"}};
const json* source_addr = &source.at("hello");
json j = {{"key", std::move(source)}};
CHECK(&(j["key"].get_ref<json::object_t const&>().at("hello")) == source_addr);
}
@@ -1200,29 +1229,34 @@ TEST_CASE("constructors")
SECTION("json")
{
json source {1, 2, 3};
const json* source_addr = &source[0];
SECTION("constructor with implicit types (array)")
{
json source {1, 2, 3};
const json* source_addr = &source[0];
json j {std::move(source), {}};
CHECK(&j[0][0] == source_addr);
}
SECTION("constructor with implicit types (object)")
{
json source {1, 2, 3};
const json* source_addr = &source[0];
json j {{"key", std::move(source)}};
CHECK(&j["key"][0] == source_addr);
}
SECTION("assignment with implicit types (array)")
{
json source {1, 2, 3};
const json* source_addr = &source[0];
json j = {std::move(source), {}};
CHECK(&j[0][0] == source_addr);
}
SECTION("assignment with implicit types (object)")
{
json source {1, 2, 3};
const json* source_addr = &source[0];
json j = {{"key", std::move(source)}};
CHECK(&j["key"][0] == source_addr);
}