@@ -26,7 +26,7 @@ namespace iceberg {
2626
2727enum class TestEnum { VALUE1, VALUE2, VALUE3 };
2828
29- std::string enumToString (const TestEnum& val) {
29+ std::string EnumToString (const TestEnum& val) {
3030 switch (val) {
3131 case TestEnum::VALUE1:
3232 return " VALUE1" ;
@@ -39,7 +39,7 @@ std::string enumToString(const TestEnum& val) {
3939 }
4040}
4141
42- TestEnum stringToEnum (const std::string& val) {
42+ TestEnum StringToEnum (const std::string& val) {
4343 if (val == " VALUE1" ) {
4444 return TestEnum::VALUE1;
4545 } else if (val == " VALUE2" ) {
@@ -57,54 +57,54 @@ class TestConfig : public ConfigBase<TestConfig> {
5757 template <typename T>
5858 using Entry = const ConfigBase<TestConfig>::Entry<T>;
5959
60- inline static const Entry<std::string> STRING_CONFIG {" string_config" , " default_value" };
61- inline static const Entry<int > INT_CONFIG {" int_config" , 25 };
62- inline static const Entry<bool > BOOL_CONFIG {" bool_config" , false };
63- inline static const Entry<TestEnum> ENUM_CONFIG {" enum_config" , TestEnum::VALUE1,
64- enumToString, stringToEnum };
65- inline static const Entry<double > DOUBLE_CONFIG {" double_config" , 3.14 };
60+ inline static const Entry<std::string> kStringConfig {" string_config" , " default_value" };
61+ inline static const Entry<int > kIntConfig {" int_config" , 25 };
62+ inline static const Entry<bool > kBoolConfig {" bool_config" , false };
63+ inline static const Entry<TestEnum> kEnumConfig {" enum_config" , TestEnum::VALUE1,
64+ EnumToString, StringToEnum };
65+ inline static const Entry<double > kDoubleConfig {" double_config" , 3.14 };
6666};
6767
6868TEST (ConfigTest, BasicOperations) {
6969 TestConfig config;
7070
7171 // Test default values
72- ASSERT_EQ (config.Get (TestConfig::STRING_CONFIG ), std::string (" default_value" ));
73- ASSERT_EQ (config.Get (TestConfig::INT_CONFIG ), 25 );
74- ASSERT_EQ (config.Get (TestConfig::BOOL_CONFIG ), false );
75- ASSERT_EQ (config.Get (TestConfig::ENUM_CONFIG ), TestEnum::VALUE1);
76- ASSERT_EQ (config.Get (TestConfig::DOUBLE_CONFIG ), 3.14 );
72+ ASSERT_EQ (config.Get (TestConfig::kStringConfig ), std::string (" default_value" ));
73+ ASSERT_EQ (config.Get (TestConfig::kIntConfig ), 25 );
74+ ASSERT_EQ (config.Get (TestConfig::kBoolConfig ), false );
75+ ASSERT_EQ (config.Get (TestConfig::kEnumConfig ), TestEnum::VALUE1);
76+ ASSERT_EQ (config.Get (TestConfig::kDoubleConfig ), 3.14 );
7777
7878 // Test setting values
79- config.Set (TestConfig::STRING_CONFIG , std::string (" new_value" ));
80- config.Set (TestConfig::INT_CONFIG , 100 );
81- config.Set (TestConfig::BOOL_CONFIG , true );
82- config.Set (TestConfig::ENUM_CONFIG , TestEnum::VALUE2);
83- config.Set (TestConfig::DOUBLE_CONFIG , 2.99 );
79+ config.Set (TestConfig::kStringConfig , std::string (" new_value" ));
80+ config.Set (TestConfig::kIntConfig , 100 );
81+ config.Set (TestConfig::kBoolConfig , true );
82+ config.Set (TestConfig::kEnumConfig , TestEnum::VALUE2);
83+ config.Set (TestConfig::kDoubleConfig , 2.99 );
8484
85- ASSERT_EQ (config.Get (TestConfig::STRING_CONFIG ), " new_value" );
86- ASSERT_EQ (config.Get (TestConfig::INT_CONFIG ), 100 );
87- ASSERT_EQ (config.Get (TestConfig::BOOL_CONFIG ), true );
88- ASSERT_EQ (config.Get (TestConfig::ENUM_CONFIG ), TestEnum::VALUE2);
89- ASSERT_EQ (config.Get (TestConfig::DOUBLE_CONFIG ), 2.99 );
85+ ASSERT_EQ (config.Get (TestConfig::kStringConfig ), " new_value" );
86+ ASSERT_EQ (config.Get (TestConfig::kIntConfig ), 100 );
87+ ASSERT_EQ (config.Get (TestConfig::kBoolConfig ), true );
88+ ASSERT_EQ (config.Get (TestConfig::kEnumConfig ), TestEnum::VALUE2);
89+ ASSERT_EQ (config.Get (TestConfig::kDoubleConfig ), 2.99 );
9090
9191 // Test unsetting a value
92- config.Unset (TestConfig::INT_CONFIG );
93- config.Unset (TestConfig::ENUM_CONFIG );
94- config.Unset (TestConfig::DOUBLE_CONFIG );
95- ASSERT_EQ (config.Get (TestConfig::INT_CONFIG ), 25 );
96- ASSERT_EQ (config.Get (TestConfig::STRING_CONFIG ), " new_value" );
97- ASSERT_EQ (config.Get (TestConfig::BOOL_CONFIG ), true );
98- ASSERT_EQ (config.Get (TestConfig::ENUM_CONFIG ), TestEnum::VALUE1);
99- ASSERT_EQ (config.Get (TestConfig::DOUBLE_CONFIG ), 3.14 );
92+ config.Unset (TestConfig::kIntConfig );
93+ config.Unset (TestConfig::kEnumConfig );
94+ config.Unset (TestConfig::kDoubleConfig );
95+ ASSERT_EQ (config.Get (TestConfig::kIntConfig ), 25 );
96+ ASSERT_EQ (config.Get (TestConfig::kStringConfig ), " new_value" );
97+ ASSERT_EQ (config.Get (TestConfig::kBoolConfig ), true );
98+ ASSERT_EQ (config.Get (TestConfig::kEnumConfig ), TestEnum::VALUE1);
99+ ASSERT_EQ (config.Get (TestConfig::kDoubleConfig ), 3.14 );
100100
101101 // Test resetting all values
102102 config.Reset ();
103- ASSERT_EQ (config.Get (TestConfig::STRING_CONFIG ), " default_value" );
104- ASSERT_EQ (config.Get (TestConfig::INT_CONFIG ), 25 );
105- ASSERT_EQ (config.Get (TestConfig::BOOL_CONFIG ), false );
106- ASSERT_EQ (config.Get (TestConfig::ENUM_CONFIG ), TestEnum::VALUE1);
107- ASSERT_EQ (config.Get (TestConfig::DOUBLE_CONFIG ), 3.14 );
103+ ASSERT_EQ (config.Get (TestConfig::kStringConfig ), " default_value" );
104+ ASSERT_EQ (config.Get (TestConfig::kIntConfig ), 25 );
105+ ASSERT_EQ (config.Get (TestConfig::kBoolConfig ), false );
106+ ASSERT_EQ (config.Get (TestConfig::kEnumConfig ), TestEnum::VALUE1);
107+ ASSERT_EQ (config.Get (TestConfig::kDoubleConfig ), 3.14 );
108108}
109109
110110} // namespace iceberg
0 commit comments