👷 add CI step for coverage
This commit is contained in:
parent
829f119632
commit
91475eeff1
8
.github/workflows/ubuntu.yml
vendored
8
.github/workflows/ubuntu.yml
vendored
@ -130,12 +130,8 @@ jobs:
|
||||
- name: build
|
||||
run: |
|
||||
cmake --build build --target ci_test_coverage
|
||||
pwd
|
||||
ls -la
|
||||
ls -la build
|
||||
ls -la build/build_coverage
|
||||
cp -r /__w/json/json/build/build_coverage/html /workdir
|
||||
cp -r /__w/json/json/build/build_coverage/json.info /workdir
|
||||
cp -r /__w/json/json/build/html /workdir
|
||||
cp -r /__w/json/json/build/json.info /workdir
|
||||
- name: archive coverage report
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
||||
@ -1119,27 +1119,33 @@ TEST_CASE("constructors")
|
||||
{
|
||||
// This should break through any short string optimization in std::string
|
||||
std::string source(1024, '!');
|
||||
const char* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
|
||||
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 char* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
|
||||
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 char* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1148,33 +1154,41 @@ TEST_CASE("constructors")
|
||||
SECTION("constructor with implicit types (array)")
|
||||
{
|
||||
json::array_t source = {1, 2, 3};
|
||||
const json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
|
||||
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 json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
|
||||
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 json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
|
||||
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 json* source_addr = source.data(); // NOLINT(clang-analyzer-cplusplus.InnerPointer)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user