mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-08 06:05:17 +00:00
Fix field-level native_type for vector pack and CreateTable args
Complete field-level native_type/native_type_pack_name support in C++ codegen by fixing two remaining locations that only checked struct-level attributes: vector-of-structs packing and CreateTable argument passing. Add tests with a struct lacking struct-level native_type to verify field-level attributes work end-to-end. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -929,6 +929,12 @@ void NativeTypeTest() {
|
||||
Native::Vector3D(20 * i + 0.1f, 20 * i + 0.2f, 20 * i + 0.3f));
|
||||
}
|
||||
|
||||
src_data.simple_position = Native::Vector3D(7.0f, 8.0f, 9.0f);
|
||||
for (int i = 0; i < N; ++i) {
|
||||
src_data.simple_vectors.push_back(
|
||||
Native::Vector3D(30 * i + 0.1f, 30 * i + 0.2f, 30 * i + 0.3f));
|
||||
}
|
||||
|
||||
src_data.matrix = std::unique_ptr<Native::Matrix>(new Native::Matrix(1, 2));
|
||||
src_data.matrix->values = {3, 4};
|
||||
|
||||
@@ -963,6 +969,17 @@ void NativeTypeTest() {
|
||||
TEST_EQ(v2.z, 20 * i + 0.3f);
|
||||
}
|
||||
|
||||
TEST_EQ(dstDataT->simple_position.x, 7.0f);
|
||||
TEST_EQ(dstDataT->simple_position.y, 8.0f);
|
||||
TEST_EQ(dstDataT->simple_position.z, 9.0f);
|
||||
|
||||
for (int i = 0; i < N; ++i) {
|
||||
const Native::Vector3D& sv = dstDataT->simple_vectors[i];
|
||||
TEST_EQ(sv.x, 30 * i + 0.1f);
|
||||
TEST_EQ(sv.y, 30 * i + 0.2f);
|
||||
TEST_EQ(sv.z, 30 * i + 0.3f);
|
||||
}
|
||||
|
||||
TEST_EQ(dstDataT->matrix->rows, 1);
|
||||
TEST_EQ(dstDataT->matrix->columns, 2);
|
||||
TEST_EQ(dstDataT->matrix->values[0], 3);
|
||||
|
||||
Reference in New Issue
Block a user