[wpiutil] Rename struct constants to all caps

This commit is contained in:
Peter Johnson
2026-03-15 22:37:36 -07:00
parent c913b27a27
commit aa88fa0fcf
48 changed files with 286 additions and 288 deletions

View File

@@ -328,14 +328,14 @@ class DynamicStructTest {
private static Stream<Arguments> provideSimpleTestParams() {
return Stream.of(
Arguments.of("bool a", 1, StructFieldType.kBool, false, false, 8, 0xff, 0, 0),
Arguments.of("char a", 1, StructFieldType.kChar, false, false, 8, 0xff, 0, 0),
Arguments.of("int8 a", 1, StructFieldType.kInt8, true, false, 8, 0xff, -128, 127),
Arguments.of("int16 a", 2, StructFieldType.kInt16, true, false, 16, 0xffff, -32768, 32767),
Arguments.of("bool a", 1, StructFieldType.BOOL, false, false, 8, 0xff, 0, 0),
Arguments.of("char a", 1, StructFieldType.CHAR, false, false, 8, 0xff, 0, 0),
Arguments.of("int8 a", 1, StructFieldType.INT8, true, false, 8, 0xff, -128, 127),
Arguments.of("int16 a", 2, StructFieldType.INT16, true, false, 16, 0xffff, -32768, 32767),
Arguments.of(
"int32 a",
4,
StructFieldType.kInt32,
StructFieldType.INT32,
true,
false,
32,
@@ -345,23 +345,23 @@ class DynamicStructTest {
Arguments.of(
"int64 a",
8,
StructFieldType.kInt64,
StructFieldType.INT64,
true,
false,
64,
-1,
-9223372036854775808L,
9223372036854775807L),
Arguments.of("uint8 a", 1, StructFieldType.kUint8, false, true, 8, 0xff, 0, 255),
Arguments.of("uint16 a", 2, StructFieldType.kUint16, false, true, 16, 0xffff, 0, 65535),
Arguments.of("uint8 a", 1, StructFieldType.UINT8, false, true, 8, 0xff, 0, 255),
Arguments.of("uint16 a", 2, StructFieldType.UINT16, false, true, 16, 0xffff, 0, 65535),
Arguments.of(
"uint32 a", 4, StructFieldType.kUint32, false, true, 32, 0xffffffffL, 0, 4294967295L),
Arguments.of("uint64 a", 8, StructFieldType.kUint64, false, true, 64, -1, 0, 0),
Arguments.of("float a", 4, StructFieldType.kFloat, false, false, 32, 0xffffffffL, 0, 0),
Arguments.of("float32 a", 4, StructFieldType.kFloat, false, false, 32, 0xffffffffL, 0, 0),
Arguments.of("double a", 8, StructFieldType.kDouble, false, false, 64, -1, 0, 0),
Arguments.of("float64 a", 8, StructFieldType.kDouble, false, false, 64, -1, 0, 0),
Arguments.of("foo a", 0, StructFieldType.kStruct, false, false, 0, 0, 0, 0));
"uint32 a", 4, StructFieldType.UINT32, false, true, 32, 0xffffffffL, 0, 4294967295L),
Arguments.of("uint64 a", 8, StructFieldType.UINT64, false, true, 64, -1, 0, 0),
Arguments.of("float a", 4, StructFieldType.FLOAT, false, false, 32, 0xffffffffL, 0, 0),
Arguments.of("float32 a", 4, StructFieldType.FLOAT, false, false, 32, 0xffffffffL, 0, 0),
Arguments.of("double a", 8, StructFieldType.DOUBLE, false, false, 64, -1, 0, 0),
Arguments.of("float64 a", 8, StructFieldType.DOUBLE, false, false, 64, -1, 0, 0),
Arguments.of("foo a", 0, StructFieldType.STRUCT, false, false, 0, 0, 0, 0));
}
@ParameterizedTest
@@ -385,7 +385,7 @@ class DynamicStructTest {
assertEquals(field.isInt(), isInt);
assertEquals(field.isUint(), isUint);
assertFalse(field.isArray());
if (type != StructFieldType.kStruct) {
if (type != StructFieldType.STRUCT) {
assertTrue(desc.isValid());
assertEquals(desc.getSize(), size);
assertEquals(field.getSize(), size);
@@ -419,7 +419,7 @@ class DynamicStructTest {
assertEquals(field.isUint(), isUint);
assertTrue(field.isArray());
assertEquals(field.getArraySize(), 2);
if (type != StructFieldType.kStruct) {
if (type != StructFieldType.STRUCT) {
assertTrue(desc.isValid());
assertEquals(desc.getSize(), size * 2);
} else {
@@ -440,7 +440,7 @@ class DynamicStructTest {
long bitMask,
long minVal,
long maxVal) {
if (type == StructFieldType.kStruct) {
if (type == StructFieldType.STRUCT) {
return;
}
var desc = assertDoesNotThrow(() -> db.add("test", schema));
@@ -448,13 +448,13 @@ class DynamicStructTest {
var dynamic = DynamicStruct.allocate(desc);
var field = desc.findFieldByName("a");
assertNotNull(field);
if ((isInt || isUint) && type != StructFieldType.kUint64) {
if ((isInt || isUint) && type != StructFieldType.UINT64) {
// Java can't represent uint64 max
dynamic.setIntField(field, minVal);
assertEquals(minVal, dynamic.getIntField(field));
dynamic.setIntField(field, maxVal);
assertEquals(maxVal, dynamic.getIntField(field));
} else if (type == StructFieldType.kBool) {
} else if (type == StructFieldType.BOOL) {
dynamic.setBoolField(field, false);
assertFalse(dynamic.getBoolField(field));
dynamic.setBoolField(field, true);

View File

@@ -502,7 +502,7 @@ TEST_P(DynamicSimpleStructTest, Check) {
EXPECT_EQ(fields[0].IsInt(), GetParam().isInt);
EXPECT_EQ(fields[0].IsUint(), GetParam().isUint);
EXPECT_FALSE(fields[0].IsArray());
if (GetParam().type != StructFieldType::kStruct) {
if (GetParam().type != StructFieldType::STRUCT) {
ASSERT_TRUE(desc->IsValid());
ASSERT_EQ(desc->GetSize(), GetParam().size);
ASSERT_EQ(fields[0].GetSize(), GetParam().size);
@@ -527,7 +527,7 @@ TEST_P(DynamicSimpleStructTest, Array) {
EXPECT_EQ(fields[0].IsUint(), GetParam().isUint);
EXPECT_TRUE(fields[0].IsArray());
EXPECT_EQ(fields[0].GetArraySize(), 2u);
if (GetParam().type != StructFieldType::kStruct) {
if (GetParam().type != StructFieldType::STRUCT) {
ASSERT_TRUE(desc->IsValid());
ASSERT_EQ(desc->GetSize(), GetParam().size * 2u);
} else {
@@ -550,7 +550,7 @@ static int64_t SignExtend(uint64_t value, size_t size) {
}
TEST_P(DynamicSimpleStructTest, IntRoundTrip) {
if (GetParam().type == StructFieldType::kStruct) {
if (GetParam().type == StructFieldType::STRUCT) {
return;
}
auto desc = db.Add("test", GetParam().schema, &err);
@@ -582,7 +582,7 @@ TEST_P(DynamicSimpleStructTest, IntRoundTrip) {
dynamic.SetUintField(field, value);
EXPECT_EQ(dynamic.GetUintField(field), value);
}
} else if (GetParam().type == StructFieldType::kBool) {
} else if (GetParam().type == StructFieldType::BOOL) {
dynamic.SetBoolField(field, false);
EXPECT_FALSE(dynamic.GetBoolField(field));
dynamic.SetBoolField(field, true);
@@ -591,39 +591,39 @@ TEST_P(DynamicSimpleStructTest, IntRoundTrip) {
}
static SimpleTestParam simpleTests[] = {
{"bool a", 1, StructFieldType::kBool, false, false, 8, UINT8_MAX, 0, 0},
{"char a", 1, StructFieldType::kChar, false, false, 8, UINT8_MAX, 0, 0},
{"int8 a", 1, StructFieldType::kInt8, true, false, 8, UINT8_MAX,
{"bool a", 1, StructFieldType::BOOL, false, false, 8, UINT8_MAX, 0, 0},
{"char a", 1, StructFieldType::CHAR, false, false, 8, UINT8_MAX, 0, 0},
{"int8 a", 1, StructFieldType::INT8, true, false, 8, UINT8_MAX,
static_cast<uint64_t>(std::numeric_limits<int8_t>::min()),
std::numeric_limits<int8_t>::max()},
{"int16 a", 2, StructFieldType::kInt16, true, false, 16, UINT16_MAX,
{"int16 a", 2, StructFieldType::INT16, true, false, 16, UINT16_MAX,
static_cast<uint64_t>(std::numeric_limits<int16_t>::min()),
std::numeric_limits<int16_t>::max()},
{"int32 a", 4, StructFieldType::kInt32, true, false, 32, UINT32_MAX,
{"int32 a", 4, StructFieldType::INT32, true, false, 32, UINT32_MAX,
static_cast<uint64_t>(std::numeric_limits<int32_t>::min()),
std::numeric_limits<int32_t>::max()},
{"int64 a", 8, StructFieldType::kInt64, true, false, 64, UINT64_MAX,
{"int64 a", 8, StructFieldType::INT64, true, false, 64, UINT64_MAX,
static_cast<uint64_t>(std::numeric_limits<int64_t>::min()),
std::numeric_limits<int64_t>::max()},
{"uint8 a", 1, StructFieldType::kUint8, false, true, 8, UINT8_MAX,
{"uint8 a", 1, StructFieldType::UINT8, false, true, 8, UINT8_MAX,
std::numeric_limits<uint8_t>::min(), std::numeric_limits<uint8_t>::max()},
{"uint16 a", 2, StructFieldType::kUint16, false, true, 16, UINT16_MAX,
{"uint16 a", 2, StructFieldType::UINT16, false, true, 16, UINT16_MAX,
std::numeric_limits<uint16_t>::min(),
std::numeric_limits<uint16_t>::max()},
{"uint32 a", 4, StructFieldType::kUint32, false, true, 32, UINT32_MAX,
{"uint32 a", 4, StructFieldType::UINT32, false, true, 32, UINT32_MAX,
std::numeric_limits<uint32_t>::min(),
std::numeric_limits<uint32_t>::max()},
{"uint64 a", 8, StructFieldType::kUint64, false, true, 64, UINT64_MAX,
{"uint64 a", 8, StructFieldType::UINT64, false, true, 64, UINT64_MAX,
std::numeric_limits<uint64_t>::min(),
std::numeric_limits<uint64_t>::max()},
{"float a", 4, StructFieldType::kFloat, false, false, 32, UINT32_MAX, 0, 0},
{"float32 a", 4, StructFieldType::kFloat, false, false, 32, UINT32_MAX, 0,
{"float a", 4, StructFieldType::FLOAT, false, false, 32, UINT32_MAX, 0, 0},
{"float32 a", 4, StructFieldType::FLOAT, false, false, 32, UINT32_MAX, 0,
0},
{"double a", 8, StructFieldType::kDouble, false, false, 64, UINT64_MAX, 0,
{"double a", 8, StructFieldType::DOUBLE, false, false, 64, UINT64_MAX, 0,
0},
{"float64 a", 8, StructFieldType::kDouble, false, false, 64, UINT64_MAX, 0,
{"float64 a", 8, StructFieldType::DOUBLE, false, false, 64, UINT64_MAX, 0,
0},
{"foo a", 0, StructFieldType::kStruct, false, false, 0, 0, 0, 0},
{"foo a", 0, StructFieldType::STRUCT, false, false, 0, 0, 0, 0},
};
INSTANTIATE_TEST_SUITE_P(DynamicSimpleStructTests, DynamicSimpleStructTest,