Skip to content

Commit

Permalink
Moved encoding to string into tests since it's only used there.
Browse files Browse the repository at this point in the history
  • Loading branch information
EpsilonPrime committed Jul 26, 2023
1 parent 0bbf8cc commit 84fd751
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
13 changes: 0 additions & 13 deletions include/substrait/common/Io.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ enum PlanFileEncoding {
kText = 3,
};

constexpr const char* PlanFileEncodingToString(PlanFileEncoding e) noexcept {
switch (e) {
case PlanFileEncoding::kBinary:
return "kBinary";
case PlanFileEncoding::kJson:
return "kJson";
case PlanFileEncoding::kProtoText:
return "kProtoText";
case PlanFileEncoding::kText:
return "kText";
}
}

// Loads a Substrait plan consisting of any encoding type from the given file.
absl::StatusOr<::substrait::proto::Plan> loadPlanWithUnknownEncoding(
std::string_view input_filename);
Expand Down
19 changes: 18 additions & 1 deletion src/substrait/common/tests/IoTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ using ::protobuf_matchers::Partially;

namespace io::substrait {

namespace {

constexpr const char* planFileEncodingToString(PlanFileEncoding e) noexcept {
switch (e) {
case PlanFileEncoding::kBinary:
return "kBinary";
case PlanFileEncoding::kJson:
return "kJson";
case PlanFileEncoding::kProtoText:
return "kProtoText";
case PlanFileEncoding::kText:
return "kText";
}
}

} // namespace

class IoTest : public ::testing::Test {};

TEST_F(IoTest, LoadMissingFile) {
Expand Down Expand Up @@ -63,7 +80,7 @@ INSTANTIATE_TEST_SUITE_P(
SaveAndLoadTestFixture,
testing::Values(kBinary, kJson, kProtoText, kText),
[](const testing::TestParamInfo<SaveAndLoadTestFixture::ParamType>& info) {
return PlanFileEncodingToString(info.param);
return planFileEncodingToString(info.param);
});

} // namespace io::substrait

0 comments on commit 84fd751

Please sign in to comment.