flatbuffers/tests
bigjt 1a7495a6dd
[C#] Add GetBytes methods for fixed arrays (#8633)
* [C#] Add GetBytes methods for fixed arrays

I wanted to direct access to fixed array bytes. I made some changes to the idl generator to create GetBytes functions following the same naming conventions used for vectors of scalar types. There was not a 'Length' field present to bound the existing index accessor so I added that too.

+ Add generic GetBytes for fixed length arrays of scalar types
+ Implement conditional compilation for ENABLE_SPAN_T:
  - ENABLE_SPAN_T: Returns `Span<T>` using `MemoryMarshal.Cast<byte, T>()` as needed.
  - Else: Returns `ArraySegment<byte>?` for raw byte access
+ Added tests reusing arrays_test.fbs definitions
+ Added const int Length field to support existing index based accessors

* [C#] Sync generated code for after adding GetBytes methods for fixed arrays

---------

Co-authored-by: Björn Harrtell <bjornharrtell@users.noreply.github.com>
2026-02-04 23:13:32 +00:00
..
64bit FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
annotated_binary docs: clean up whitespace and fix typo in tutorial.md (#8695) 2025-09-25 09:02:22 -07:00
arrays_test Fixes unused imports in Rust code generator (#8828) 2025-12-04 21:59:47 -08:00
bazel_repository_test_dir
cpp17 C++ Feature: Mutable union getters (#8852) 2025-12-21 17:36:47 -05:00
DictionaryLookup FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
docker
evolution_test FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
FlatBuffers.Benchmarks
FlatBuffers.Test [C#] Add GetBytes methods for fixed arrays (#8633) 2026-02-04 23:13:32 +00:00
flatc disallow circular struct references (#8851) 2026-02-04 15:15:05 +00:00
fuzzer Run clang-format -i **/*.cpp (#8865) 2025-12-19 10:42:57 -08:00
include_test
include_test1 Fixes unused imports in Rust code generator (#8828) 2025-12-04 21:59:47 -08:00
include_test2 Fixes unused imports in Rust code generator (#8828) 2025-12-04 21:59:47 -08:00
key_field FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
keyword_test Fixes unused imports in Rust code generator (#8828) 2025-12-04 21:59:47 -08:00
KeywordTest FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
minified_enums FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
monster_test Fixes unused imports in Rust code generator (#8828) 2025-12-04 21:59:47 -08:00
monster_test_serialize Fixes unused imports in Rust code generator (#8828) 2025-12-04 21:59:47 -08:00
monster_test_suffix C++ Feature: Mutable union getters (#8852) 2025-12-21 17:36:47 -05:00
more_defaults Fixes unused imports in Rust code generator (#8828) 2025-12-04 21:59:47 -08:00
MyGame [C#] Add GetBytes methods for fixed arrays (#8633) 2026-02-04 23:13:32 +00:00
name_clash_test
namespace_test C++ Feature: Mutable union getters (#8852) 2025-12-21 17:36:47 -05:00
nested_namespace_test FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
nim
optional_scalars FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
order
private_annotation_test Fixes unused imports in Rust code generator (#8828) 2025-12-04 21:59:47 -08:00
prototest
rust_namer_test Fixes unused imports in Rust code generator (#8828) 2025-12-04 21:59:47 -08:00
rust_no_std_compilation_test
rust_reflection_test
rust_serialize_test [rust] add deser support for enum type (#8803) 2025-12-02 22:48:45 -05:00
rust_usage_test Fixes Rust code generation for single file output when using namespaces (#8877) 2026-02-04 15:28:18 +00:00
swift FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
ts Add --ts-undefined-for-optionals command line option (#8861) 2026-02-04 13:37:41 +01:00
type_field_collsion FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
union_value_collsion FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
union_vector C++ Feature: Mutable union getters (#8852) 2025-12-21 17:36:47 -05:00
vector_table_naked_ptr FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
.gitignore
Abc.nim FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
alignment_test.cpp
alignment_test.fbs
alignment_test.h
alignment_test.json
alignment_test_after_fix.afb
alignment_test_after_fix.bin
alignment_test_before_fix.afb
alignment_test_before_fix.bin
arrays_test.bfbs Arrays of Enumerations without a value for 0 are no longer valid (#8836) 2025-12-13 18:40:58 -05:00
arrays_test.fbs
arrays_test.golden
arrays_test.schema.json
BUILD.bazel Default Vector Support C++ (#8870) 2025-12-19 14:32:51 -08:00
DartTest.sh
default_vectors_strings_test.cpp Default Vector Support C++ (#8870) 2025-12-19 14:32:51 -08:00
default_vectors_strings_test.fbs Default Vector Support C++ (#8870) 2025-12-19 14:32:51 -08:00
default_vectors_strings_test.h Default Vector Support C++ (#8870) 2025-12-19 14:32:51 -08:00
dictionary_lookup.fbs
evolution_test.cpp
evolution_test.h
flexbuffers_test.cpp
flexbuffers_test.h
fuzz_test.cpp
fuzz_test.h
go_test.go fix(go): add bounds checking to ByteVector (#8776) 2025-12-21 20:25:30 +00:00
gold_flexbuffer_example.bin
GoTest.sh [Go] Write required string fields into the buffer when using Object API (#8402) 2025-12-01 09:50:03 -05:00
include_build_test.cc
include_test1_generated.dart
include_test1_generated.rs Fixes Rust code generation for single file output when using namespaces (#8877) 2026-02-04 15:28:18 +00:00
include_test2_generated.rs Fixes Rust code generation for single file output when using namespaces (#8877) 2026-02-04 15:28:18 +00:00
include_test2_my_game.other_name_space_generated.dart
included_test.fbs
includer_test.fbs
is_quiet_nan.h
javatest.bin
json_test.cpp
json_test.h
key_field_test.cpp
key_field_test.h
keyword_test.fbs
KotlinTest.kt Fix nullability of generated Kotlin ByteBuffer accessors (#8844) 2025-12-14 18:56:40 -05:00
KotlinTest.sh
LobsterTest.bat
lobstertest.lobster
long_namespace.fbs
longer_namespace.fbs
LuaTest.bat
luatest.lua
LuaTest.sh
monster_extra.fbs
monster_extra_generated.h FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
monster_extra_my_game_generated.dart [dart] fix bug which generated wrong code (#8780) 2025-11-24 10:54:43 -05:00
monster_test.afb Arrays of Enumerations without a value for 0 are no longer valid (#8836) 2025-12-13 18:40:58 -05:00
monster_test.bfbs Arrays of Enumerations without a value for 0 are no longer valid (#8836) 2025-12-13 18:40:58 -05:00
monster_test.cpp
monster_test.fbs
monster_test.grpc.fb.cc
monster_test.grpc.fb.h
monster_test.h
monster_test.schema.json
monster_test_bfbs_generated.h Arrays of Enumerations without a value for 0 are no longer valid (#8836) 2025-12-13 18:40:58 -05:00
monster_test_callback.grpc.fb.cc
monster_test_callback.grpc.fb.h
monster_test_generated.grpc.fb.cc
monster_test_generated.grpc.fb.h
monster_test_generated.h C++ Feature: Mutable union getters (#8852) 2025-12-21 17:36:47 -05:00
monster_test_generated.lobster
monster_test_generated.py [Python] Improve python API (#8781) 2026-01-21 01:01:20 +00:00
monster_test_generated.ts
monster_test_my_game.example2_generated.dart
monster_test_my_game.example_generated.dart Refactor lazy list unpacking (#8746) 2025-10-31 13:41:59 -07:00
monster_test_my_game_generated.dart
monsterdata_extra.json
monsterdata_go_wire.mon.sp
monsterdata_python_wire.mon
monsterdata_test.afb
monsterdata_test.golden
monsterdata_test.json
monsterdata_test.mon
more_defaults.fbs
MoreDefaults.nim FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
MutatingBool.fbs
nan_inf_test.fbs
native_inline_table_test.fbs
native_inline_table_test_generated.h FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
native_type_test.fbs Support native_type for tables when using the C++ object API. (#8668) 2025-11-05 07:50:10 -08:00
native_type_test_generated.h FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
native_type_test_impl.cpp Run clang-format -i **/*.cpp (#8865) 2025-12-19 10:42:57 -08:00
native_type_test_impl.h Run clang-format -i **/*.cpp (#8865) 2025-12-19 10:42:57 -08:00
nested_union_test.fbs
non_zero_enum.fbs Arrays of Enumerations without a value for 0 are no longer valid (#8836) 2025-12-13 18:40:58 -05:00
optional_scalars.fbs
optional_scalars.json
optional_scalars_defaults.json
optional_scalars_generated.h FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
optional_scalars_generated.lobster
optional_scalars_generated.ts
optional_scalars_test.cpp
optional_scalars_test.h
parser_test.cpp
parser_test.h
phpTest.php
phpUnionVectorTest.php
phpUnionVectorTest.sh
Pizza.go
private_annotation_test.fbs
Property.nim FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
proto_test.cpp
proto_test.h
py_flexbuffers_test.py
py_test.py [Python] Improve python API (#8781) 2026-01-21 01:01:20 +00:00
PythonTest.sh
reflection_test.cpp
reflection_test.h
required_strings.fbs
rust_namer_test.fbs
RustTest.bat
RustTest.sh
service_test.fbs
service_test_generated.py [Python] Improve python API (#8781) 2026-01-21 01:01:20 +00:00
service_test_generated.pyi
service_test_grpc.fb.py
service_test_grpc.fb.pyi
TableA.lua FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
TableA.nim FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
TableAT.java
test.cpp Default Vector Support C++ (#8870) 2025-12-19 14:32:51 -08:00
test.fbs
test_assert.cpp
test_assert.h
test_builder.cpp
test_builder.h
TestAll.sh
TestMutatingBool.nim FlatBuffers Version 25.12.19 (#8871) 2025-12-19 15:06:07 -08:00
type_field_collsion.fbs
unicode_test.json
unicode_test.mon
union_underlying_type_test.fbs
union_underlying_type_test_generated.h C++ Feature: Mutable union getters (#8852) 2025-12-21 17:36:47 -05:00
union_value_collision.fbs
util_test.cpp
util_test.h
vector_has_test.fbs
vector_table_naked_ptr.fbs Fix vector of table with naked ptr (#8830) 2025-12-07 11:05:54 -08:00
vector_table_naked_ptr_test.cpp Fix vector of table with naked ptr (#8830) 2025-12-07 11:05:54 -08:00
vector_table_naked_ptr_test.h Fix vector of table with naked ptr (#8830) 2025-12-07 11:05:54 -08:00