Add test for flatbuffers array header - #437
Open
paulquiring wants to merge 2 commits into
Open
Conversation
paulquiring
requested review from
4og,
antonkri,
arkjedrz and
pawelrutkaq
as code owners
July 31, 2026 12:06
paulquiring
temporarily deployed
to
workflow-approval
July 31, 2026 12:07 — with
GitHub Actions
Inactive
paulquiring
temporarily deployed
to
workflow-approval
July 31, 2026 12:07 — with
GitHub Actions
Inactive
paulquiring
temporarily deployed
to
workflow-approval
July 31, 2026 12:07 — with
GitHub Actions
Inactive
paulquiring
temporarily deployed
to
workflow-approval
July 31, 2026 12:07 — with
GitHub Actions
Inactive
|
The created documentation from the pull request is available at: docu-html |
MaciejKaszynski
requested changes
Aug 3, 2026
There was a problem hiding this comment.
Pull request overview
This PR adds GoogleTest coverage for the upstream FlatBuffers C++ headers used by score/flatbuffers, specifically targeting flatbuffers/array.h and flatbuffers/allocator.h, and wires the new tests into the Bazel cc_test target.
Changes:
- Add comprehensive unit/fault-injection tests for
flatbuffers/array.hAPIs and specializations. - Add interface/fault-injection tests for
flatbuffers/allocator.h, includingAllocator::reallocate_downward. - Fix and expand
score/flatbuffers:flatbuffers_cpp_library_testsources inscore/flatbuffers/BUILD.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| score/flatbuffers/details/flatbuffers_array_test.cpp | New test suite covering flatbuffers::Array behaviors (casts, iteration, spans, mutation, CopyFromSpan, specialization/death tests). |
| score/flatbuffers/details/flatbuffers_allocator_test.cpp | New test suite validating flatbuffers::Allocator contract and default reallocate_downward behavior (including fault paths). |
| score/flatbuffers/BUILD | Updates flatbuffers_cpp_library_test to use the correct allocator test filename and adds the new array tests. |
Suppressed comments (3)
score/flatbuffers/details/flatbuffers_array_test.cpp:664
- This downcast is undefined behavior: CastToArray(raw) does not produce an ArrayTestAccess<T,N> object, so static_casting the base reference to the derived type is invalid. Use an explicit reinterpret_cast overlay if you need to call the protected overloads.
auto& accessor = static_cast<ArrayTestAccess<int32_t, 3>&>(CastToArray(raw));
score/flatbuffers/details/flatbuffers_array_test.cpp:683
- This downcast is undefined behavior: CastToArray(raw) does not produce an ArrayTestAccess<T,N> object, so static_casting the base reference to the derived type is invalid. Use an explicit reinterpret_cast overlay if you need to call the protected overloads.
auto& accessor = static_cast<ArrayTestAccess<Point, 2>&>(CastToArray(raw));
score/flatbuffers/details/flatbuffers_array_test.cpp:756
- This reinterpret_cast assumes the byte buffer is suitably aligned (and large enough) for Array<Offset, 2>. Use alignas + sizeof(Array<...>) to avoid misalignment/size-related UB.
uint8_t buf[2] = {0};
const auto& arr = *reinterpret_cast<const Array<Offset<void>, 2>*>(buf);
EXPECT_DEATH({ arr[0]; }, "");
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
paulquiring
force-pushed
the
paulquiring/add_flatbuffers_array_test
branch
from
August 4, 2026 10:09
35ebbe4 to
ffa0e6e
Compare
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 10:09 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 10:09 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 10:09 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 10:09 — with
GitHub Actions
Waiting
paulquiring
force-pushed
the
paulquiring/add_flatbuffers_array_test
branch
from
August 4, 2026 11:16
ffa0e6e to
d16d6a5
Compare
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 11:16 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 11:16 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 11:16 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 11:42 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 11:42 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 11:42 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 11:42 — with
GitHub Actions
Waiting
paulquiring
force-pushed
the
paulquiring/add_flatbuffers_array_test
branch
from
August 4, 2026 13:28
19633fe to
dbbd577
Compare
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 13:28 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 13:28 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 13:28 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 13:28 — with
GitHub Actions
Waiting
paulquiring
force-pushed
the
paulquiring/add_flatbuffers_array_test
branch
from
August 4, 2026 13:54
dbbd577 to
73860ec
Compare
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 13:54 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 13:54 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 13:54 — with
GitHub Actions
Waiting
paulquiring
requested a deployment
to
workflow-approval
August 4, 2026 13:54 — with
GitHub Actions
Waiting
MaciejKaszynski
previously approved these changes
Aug 4, 2026
paulquiring
force-pushed
the
paulquiring/add_flatbuffers_array_test
branch
from
August 4, 2026 14:04
73860ec to
15f5bcf
Compare
paulquiring
temporarily deployed
to
workflow-approval
August 4, 2026 14:04 — with
GitHub Actions
Inactive
paulquiring
temporarily deployed
to
workflow-approval
August 4, 2026 14:04 — with
GitHub Actions
Inactive
paulquiring
temporarily deployed
to
workflow-approval
August 4, 2026 14:04 — with
GitHub Actions
Inactive
paulquiring
temporarily deployed
to
workflow-approval
August 4, 2026 14:04 — with
GitHub Actions
Inactive
paulquiring
force-pushed
the
paulquiring/add_flatbuffers_array_test
branch
from
August 5, 2026 08:02
15f5bcf to
f5737c8
Compare
paulquiring
temporarily deployed
to
workflow-approval
August 5, 2026 08:02 — with
GitHub Actions
Inactive
paulquiring
temporarily deployed
to
workflow-approval
August 5, 2026 08:02 — with
GitHub Actions
Inactive
paulquiring
temporarily deployed
to
workflow-approval
August 5, 2026 08:02 — with
GitHub Actions
Inactive
paulquiring
temporarily deployed
to
workflow-approval
August 5, 2026 08:02 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add test for flatbuffers/array.h.