👷 add CI step for coverage

This commit is contained in:
Niels Lohmann 2021-01-31 15:50:25 +01:00
parent 9ced2bf5c3
commit 21a193c69b
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
5 changed files with 14 additions and 14 deletions

View File

@ -130,7 +130,7 @@ jobs:
- name: build - name: build
run: cmake --build build --target ci_test_coverage run: cmake --build build --target ci_test_coverage
- name: copy - name: copy
run: cp -r html /workdir ; cp -r json.info /workdir run: cp -r build/build_coverage/html /workdir ; cp -r build/build_coverage/json.info /workdir
- name: archive coverage report - name: archive coverage report
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:

View File

@ -1119,7 +1119,7 @@ TEST_CASE("constructors")
{ {
// This should break through any short string optimization in std::string // This should break through any short string optimization in std::string
std::string source(1024, '!'); std::string source(1024, '!');
const char* source_addr = source.data(); const char* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
json j = {std::move(source)}; json j = {std::move(source)};
CHECK(j[0].get_ref<std::string const&>().data() == source_addr); CHECK(j[0].get_ref<std::string const&>().data() == source_addr);
} }
@ -1128,7 +1128,7 @@ TEST_CASE("constructors")
{ {
// This should break through any short string optimization in std::string // This should break through any short string optimization in std::string
std::string source(1024, '!'); std::string source(1024, '!');
const char* source_addr = source.data(); const char* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
json j = {{"key", std::move(source)}}; json j = {{"key", std::move(source)}};
CHECK(j["key"].get_ref<std::string const&>().data() == source_addr); CHECK(j["key"].get_ref<std::string const&>().data() == source_addr);
} }
@ -1137,7 +1137,7 @@ TEST_CASE("constructors")
{ {
// This should break through any short string optimization in std::string // This should break through any short string optimization in std::string
std::string source(1024, '!'); std::string source(1024, '!');
const char* source_addr = source.data(); const char* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
json j = {{std::move(source), 42}}; json j = {{std::move(source), 42}};
CHECK(j.get_ref<json::object_t&>().begin()->first.data() == source_addr); CHECK(j.get_ref<json::object_t&>().begin()->first.data() == source_addr);
} }
@ -1148,7 +1148,7 @@ TEST_CASE("constructors")
SECTION("constructor with implicit types (array)") SECTION("constructor with implicit types (array)")
{ {
json::array_t source = {1, 2, 3}; json::array_t source = {1, 2, 3};
const json* source_addr = source.data(); const json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
json j {std::move(source)}; json j {std::move(source)};
CHECK(j[0].get_ref<json::array_t const&>().data() == source_addr); CHECK(j[0].get_ref<json::array_t const&>().data() == source_addr);
} }
@ -1156,7 +1156,7 @@ TEST_CASE("constructors")
SECTION("constructor with implicit types (object)") SECTION("constructor with implicit types (object)")
{ {
json::array_t source = {1, 2, 3}; json::array_t source = {1, 2, 3};
const json* source_addr = source.data(); const json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
json j {{"key", std::move(source)}}; json j {{"key", std::move(source)}};
CHECK(j["key"].get_ref<json::array_t const&>().data() == source_addr); CHECK(j["key"].get_ref<json::array_t const&>().data() == source_addr);
} }
@ -1164,7 +1164,7 @@ TEST_CASE("constructors")
SECTION("assignment with implicit types (array)") SECTION("assignment with implicit types (array)")
{ {
json::array_t source = {1, 2, 3}; json::array_t source = {1, 2, 3};
const json* source_addr = source.data(); const json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
json j = {std::move(source)}; json j = {std::move(source)};
CHECK(j[0].get_ref<json::array_t const&>().data() == source_addr); CHECK(j[0].get_ref<json::array_t const&>().data() == source_addr);
} }
@ -1172,7 +1172,7 @@ TEST_CASE("constructors")
SECTION("assignment with implicit types (object)") SECTION("assignment with implicit types (object)")
{ {
json::array_t source = {1, 2, 3}; json::array_t source = {1, 2, 3};
const json* source_addr = source.data(); const json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
json j = {{"key", std::move(source)}}; json j = {{"key", std::move(source)}};
CHECK(j["key"].get_ref<json::array_t const&>().data() == source_addr); CHECK(j["key"].get_ref<json::array_t const&>().data() == source_addr);
} }

View File

@ -94,7 +94,7 @@ template<typename T>
struct foo_serializer < T, typename std::enable_if < !std::is_same<foo, T>::value >::type > struct foo_serializer < T, typename std::enable_if < !std::is_same<foo, T>::value >::type >
{ {
template <typename BasicJsonType> template <typename BasicJsonType>
static void to_json(BasicJsonType& j, const T& value) noexcept static void to_json(BasicJsonType& j, const T& value) noexcept // NOLINT(bugprone-exception-escape)
{ {
::nlohmann::to_json(j, value); ::nlohmann::to_json(j, value);
} }

View File

@ -407,7 +407,7 @@ TEST_CASE("adl_serializer specialization" * doctest::test_suite("udt"))
json j = optPerson; json j = optPerson;
CHECK(j.is_null()); CHECK(j.is_null());
optPerson.reset(new udt::person{{42}, {"John Doe"}, udt::country::russia}); // NOLINT(cppcoreguidelines-owning-memory) optPerson.reset(new udt::person{{42}, {"John Doe"}, udt::country::russia}); // NOLINT(cppcoreguidelines-owning-memory,modernize-make-shared)
j = optPerson; j = optPerson;
CHECK_FALSE(j.is_null()); CHECK_FALSE(j.is_null());

View File

@ -99,7 +99,7 @@ template <
class T, class T,
class Compare = fifo_map_compare<Key>, class Compare = fifo_map_compare<Key>,
class Allocator = std::allocator<std::pair<const Key, T>> class Allocator = std::allocator<std::pair<const Key, T>>
> class fifo_map > class fifo_map // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions,-warnings-as-errors)
{ {
public: public:
using key_type = Key; using key_type = Key;
@ -514,10 +514,10 @@ template <
internal_map_type m_map; internal_map_type m_map;
}; };
} } // namespace nlohmann
// specialization of std::swap // specialization of std::swap
namespace std namespace std // NOLINT(cert-dcl58-cpp,-warnings-as-errors)
{ {
template <class Key, class T, class Compare, class Allocator> template <class Key, class T, class Compare, class Allocator>
inline void swap(nlohmann::fifo_map<Key, T, Compare, Allocator>& m1, inline void swap(nlohmann::fifo_map<Key, T, Compare, Allocator>& m1,
@ -525,6 +525,6 @@ inline void swap(nlohmann::fifo_map<Key, T, Compare, Allocator>& m1,
{ {
m1.swap(m2); m1.swap(m2);
} }
} } // namespace std
#endif #endif