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 Aug 5, 2024
1 parent dcb16d0 commit a4a0771
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(
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 a4a0771

Please sign in to comment.