Skip to content

Commit a12fed4

Browse files
committed
fix: modernize-avoid-c-arrays cpp-linter
Signed-off-by: Junwang Zhao <[email protected]>
1 parent 1b84ff5 commit a12fed4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

test/type_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ TEST_P(TypeTest, StdFormat) {
8888
ASSERT_EQ(test_case.repr, std::format("{}", *test_case.type));
8989
}
9090

91-
const static TypeTestCase kPrimitiveTypes[] = {
91+
const static std::array<TypeTestCase, 16> kPrimitiveTypes = {{
9292
{
9393
.name = "boolean",
9494
.type = std::make_shared<iceberg::BooleanType>(),
@@ -201,9 +201,9 @@ const static TypeTestCase kPrimitiveTypes[] = {
201201
.primitive = true,
202202
.repr = "uuid",
203203
},
204-
};
204+
}};
205205

206-
const static TypeTestCase kNestedTypes[] = {
206+
const static std::array<TypeTestCase, 4> kNestedTypes = {{
207207
{
208208
.name = "list_int",
209209
.type = std::make_shared<iceberg::ListType>(
@@ -249,7 +249,7 @@ const static TypeTestCase kNestedTypes[] = {
249249
bar (2): string (optional)
250250
>)",
251251
},
252-
};
252+
}};
253253

254254
INSTANTIATE_TEST_SUITE_P(Primitive, TypeTest, ::testing::ValuesIn(kPrimitiveTypes),
255255
TypeTestCaseToString);

test/visit_type_test.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
namespace iceberg {
3333

3434
namespace {
35+
3536
class TypeNameVisitor {
3637
public:
3738
Status Visit(const Type& type, std::ostringstream& oss) {
@@ -53,7 +54,7 @@ std::string TypeTestCaseToString(const ::testing::TestParamInfo<TypeTestCase>& i
5354
return info.param.name;
5455
}
5556

56-
const static TypeTestCase kPrimitiveTypes[] = {
57+
const static std::array<TypeTestCase, 16> kPrimitiveTypes = {{
5758
{
5859
.name = "boolean",
5960
.type = std::make_shared<iceberg::BooleanType>(),
@@ -166,9 +167,9 @@ const static TypeTestCase kPrimitiveTypes[] = {
166167
.primitive = true,
167168
.repr = "uuid",
168169
},
169-
};
170+
}};
170171

171-
const static TypeTestCase kNestedTypes[] = {
172+
const static std::array<TypeTestCase, 4> kNestedTypes = {{
172173
{
173174
.name = "list_int",
174175
.type = std::make_shared<iceberg::ListType>(
@@ -214,7 +215,7 @@ const static TypeTestCase kNestedTypes[] = {
214215
bar (2): string (optional)
215216
>)",
216217
},
217-
};
218+
}};
218219

219220
} // namespace
220221

0 commit comments

Comments
 (0)