From 84fd751e4be9c0eaecf39d7b30db50a6f245816b Mon Sep 17 00:00:00 2001 From: David Sisson Date: Wed, 26 Jul 2023 02:21:18 -0700 Subject: [PATCH] Moved encoding to string into tests since it's only used there. --- include/substrait/common/Io.h | 13 ------------- src/substrait/common/tests/IoTest.cpp | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/include/substrait/common/Io.h b/include/substrait/common/Io.h index d090cf75..4227f7a3 100644 --- a/include/substrait/common/Io.h +++ b/include/substrait/common/Io.h @@ -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); diff --git a/src/substrait/common/tests/IoTest.cpp b/src/substrait/common/tests/IoTest.cpp index c55b2dab..61c7631f 100644 --- a/src/substrait/common/tests/IoTest.cpp +++ b/src/substrait/common/tests/IoTest.cpp @@ -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) { @@ -63,7 +80,7 @@ INSTANTIATE_TEST_SUITE_P( SaveAndLoadTestFixture, testing::Values(kBinary, kJson, kProtoText, kText), [](const testing::TestParamInfo& info) { - return PlanFileEncodingToString(info.param); + return planFileEncodingToString(info.param); }); } // namespace io::substrait