Skip to content

Commit

Permalink
Adapt test to recent rebase
Browse files Browse the repository at this point in the history
Reading the chunk table requires NOT using template mode, otherwise the
string just consists of '\0' bytes.
  • Loading branch information
franzpoeschel committed Jun 7, 2024
1 parent 5a6cd39 commit 2914e8c
Showing 1 changed file with 45 additions and 18 deletions.
63 changes: 45 additions & 18 deletions test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1603,28 +1603,18 @@ struct ReadFromAnyType
}
};

inline void write_test(const std::string &backend)
inline void write_test(

Check warning

Code scanning / CodeQL

Poorly documented large function Warning test

Poorly documented function: fewer than 2% comments for a function of 134 lines.
const std::string &backend,
std::string jsonCfg = "{}",
bool test_rank_table = true)
{
#ifdef _WIN32
std::string jsonCfg = "{}";
#else
std::string jsonCfg = R"({"rank_table": "posix_hostname"})";
#ifndef _WIN32
jsonCfg = json::merge(jsonCfg, R"({"rank_table": "posix_hostname"})");
chunk_assignment::RankMeta compare{
{0,
host_info::byMethod(
host_info::methodFromStringDescription("posix_hostname", false))}};
#endif
jsonCfg = json::merge(jsonCfg, R"(
{
"json": {
"dataset": {
"mode": "template"
},
"attribute": {
"mode": "short"
}
}
})");
Series o =
Series("../samples/serial_write." + backend, Access::CREATE, jsonCfg);

Expand Down Expand Up @@ -1741,15 +1731,52 @@ inline void write_test(const std::string &backend)
variantTypeDataset);

#ifndef _WIN32
REQUIRE(read.rankTable(/* collective = */ false) == compare);
if (test_rank_table)
{
REQUIRE(read.rankTable(/* collective = */ false) == compare);
}
#endif
}

TEST_CASE("write_test", "[serial]")
{
for (auto const &t : testedFileExtensions())
{
write_test(t);
if (t == "json")
{
write_test(
"template." + t,
R"(
{
"json": {
"dataset": {
"mode": "template"
},
"attribute": {
"mode": "short"
}
}
})",
false);
write_test(
t,
R"(
{
"json": {
"dataset": {
"mode": "dataset"
},
"attribute": {
"mode": "short"
}
}
})",
true);
}
else
{
write_test(t);
}
Series list{"../samples/serial_write." + t, Access::READ_ONLY};
helper::listSeries(list);
}
Expand Down

0 comments on commit 2914e8c

Please sign in to comment.