mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 19:08:28 +00:00
Use the Google Style for clang-format without exceptions (#8706)
This reduces the friction when merging from github and google repos by using the exact same clang style guide. MARKDOWN=true
This commit is contained in:
@@ -15,10 +15,10 @@ using namespace keyfield::sample;
|
||||
void FixedSizedScalarKeyInStructTest() {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
std::vector<Baz> bazs;
|
||||
uint8_t test_array1[4] = { 8, 2, 3, 0 };
|
||||
uint8_t test_array2[4] = { 1, 2, 3, 4 };
|
||||
uint8_t test_array3[4] = { 2, 2, 3, 4 };
|
||||
uint8_t test_array4[4] = { 3, 2, 3, 4 };
|
||||
uint8_t test_array1[4] = {8, 2, 3, 0};
|
||||
uint8_t test_array2[4] = {1, 2, 3, 4};
|
||||
uint8_t test_array3[4] = {2, 2, 3, 4};
|
||||
uint8_t test_array4[4] = {3, 2, 3, 4};
|
||||
bazs.push_back(Baz(flatbuffers::make_span(test_array1), 4));
|
||||
bazs.push_back(Baz(flatbuffers::make_span(test_array2), 1));
|
||||
bazs.push_back(Baz(flatbuffers::make_span(test_array3), 2));
|
||||
@@ -27,10 +27,10 @@ void FixedSizedScalarKeyInStructTest() {
|
||||
|
||||
auto test_string = fbb.CreateString("TEST");
|
||||
|
||||
float test_float_array1[3] = { 1.5, 2.5, 0 };
|
||||
float test_float_array2[3] = { 7.5, 2.5, 0 };
|
||||
float test_float_array3[3] = { 1.5, 2.5, -1 };
|
||||
float test_float_array4[3] = { -1.5, 2.5, 0 };
|
||||
float test_float_array1[3] = {1.5, 2.5, 0};
|
||||
float test_float_array2[3] = {7.5, 2.5, 0};
|
||||
float test_float_array3[3] = {1.5, 2.5, -1};
|
||||
float test_float_array4[3] = {-1.5, 2.5, 0};
|
||||
std::vector<Bar> bars;
|
||||
bars.push_back(Bar(flatbuffers::make_span(test_float_array1), 3));
|
||||
bars.push_back(Bar(flatbuffers::make_span(test_float_array2), 4));
|
||||
@@ -42,7 +42,7 @@ void FixedSizedScalarKeyInStructTest() {
|
||||
|
||||
fbb.Finish(t);
|
||||
|
||||
uint8_t *buf = fbb.GetBufferPointer();
|
||||
uint8_t* buf = fbb.GetBufferPointer();
|
||||
auto foo_table = GetFooTable(buf);
|
||||
|
||||
auto sorted_baz_vec = foo_table->d();
|
||||
@@ -50,37 +50,37 @@ void FixedSizedScalarKeyInStructTest() {
|
||||
TEST_EQ(sorted_baz_vec->Get(3)->b(), 4);
|
||||
|
||||
uint8_t test_array[4];
|
||||
auto *key_array = &flatbuffers::CastToArray(test_array);
|
||||
auto* key_array = &flatbuffers::CastToArray(test_array);
|
||||
key_array->CopyFromSpan(flatbuffers::make_span(test_array1));
|
||||
|
||||
TEST_NOTNULL(sorted_baz_vec->LookupByKey(key_array));
|
||||
TEST_EQ(sorted_baz_vec->LookupByKey(key_array)->b(), 4);
|
||||
uint8_t array_int[4] = { 7, 2, 3, 0 };
|
||||
uint8_t array_int[4] = {7, 2, 3, 0};
|
||||
key_array->CopyFromSpan(flatbuffers::make_span(array_int));
|
||||
TEST_EQ(sorted_baz_vec->LookupByKey(key_array),
|
||||
static_cast<const Baz *>(nullptr));
|
||||
static_cast<const Baz*>(nullptr));
|
||||
|
||||
auto sorted_bar_vec = foo_table->e();
|
||||
TEST_EQ(sorted_bar_vec->Get(0)->b(), 1);
|
||||
TEST_EQ(sorted_bar_vec->Get(3)->b(), 4);
|
||||
|
||||
float test_float_array[3];
|
||||
auto *key_float_array = &flatbuffers::CastToArray(test_float_array);
|
||||
auto* key_float_array = &flatbuffers::CastToArray(test_float_array);
|
||||
key_float_array->CopyFromSpan(flatbuffers::make_span(test_float_array1));
|
||||
TEST_NOTNULL(sorted_bar_vec->LookupByKey(key_float_array));
|
||||
TEST_EQ(sorted_bar_vec->LookupByKey(key_float_array)->b(), 3);
|
||||
float array_float[3] = { -1, -2, -3 };
|
||||
float array_float[3] = {-1, -2, -3};
|
||||
key_float_array->CopyFromSpan(flatbuffers::make_span(array_float));
|
||||
TEST_EQ(sorted_bar_vec->LookupByKey(key_float_array),
|
||||
static_cast<const Bar *>(nullptr));
|
||||
static_cast<const Bar*>(nullptr));
|
||||
}
|
||||
|
||||
void StructKeyInStructTest() {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
std::vector<Apple> apples;
|
||||
float test_float_array1[3] = { 1.5, 2.5, 0 };
|
||||
float test_float_array2[3] = { 7.5, 2.5, 0 };
|
||||
float test_float_array3[3] = { 1.5, 2.5, -1 };
|
||||
float test_float_array1[3] = {1.5, 2.5, 0};
|
||||
float test_float_array2[3] = {7.5, 2.5, 0};
|
||||
float test_float_array3[3] = {1.5, 2.5, -1};
|
||||
apples.push_back(
|
||||
Apple(2, Color(flatbuffers::make_span(test_float_array1), 3)));
|
||||
apples.push_back(
|
||||
@@ -100,7 +100,7 @@ void StructKeyInStructTest() {
|
||||
auto orc = foo_builder.Finish();
|
||||
fbb.Finish(orc);
|
||||
|
||||
uint8_t *buf = fbb.GetBufferPointer();
|
||||
uint8_t* buf = fbb.GetBufferPointer();
|
||||
auto foo_table = GetFooTable(buf);
|
||||
|
||||
auto sorted_apple_vec = foo_table->f();
|
||||
@@ -113,15 +113,15 @@ void StructKeyInStructTest() {
|
||||
2);
|
||||
TEST_EQ(sorted_apple_vec->LookupByKey(
|
||||
Color(flatbuffers::make_span(test_float_array1), 0)),
|
||||
static_cast<const Apple *>(nullptr));
|
||||
static_cast<const Apple*>(nullptr));
|
||||
}
|
||||
|
||||
void NestedStructKeyInStructTest() {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
std::vector<Fruit> fruits;
|
||||
float test_float_array1[3] = { 1.5, 2.5, 0 };
|
||||
float test_float_array2[3] = { 1.5, 2.5, 0 };
|
||||
float test_float_array3[3] = { 1.5, 2.5, -1 };
|
||||
float test_float_array1[3] = {1.5, 2.5, 0};
|
||||
float test_float_array2[3] = {1.5, 2.5, 0};
|
||||
float test_float_array3[3] = {1.5, 2.5, -1};
|
||||
|
||||
fruits.push_back(
|
||||
Fruit(Apple(2, Color(flatbuffers::make_span(test_float_array1), 2)), 2));
|
||||
@@ -140,7 +140,7 @@ void NestedStructKeyInStructTest() {
|
||||
|
||||
auto orc = foo_builder.Finish();
|
||||
fbb.Finish(orc);
|
||||
uint8_t *buf = fbb.GetBufferPointer();
|
||||
uint8_t* buf = fbb.GetBufferPointer();
|
||||
auto foo_table = GetFooTable(buf);
|
||||
|
||||
auto sorted_fruit_vec = foo_table->g();
|
||||
@@ -154,34 +154,31 @@ void NestedStructKeyInStructTest() {
|
||||
1);
|
||||
TEST_EQ(sorted_fruit_vec->LookupByKey(
|
||||
Apple(1, Color(flatbuffers::make_span(test_float_array2), 1))),
|
||||
static_cast<const Fruit *>(nullptr));
|
||||
static_cast<const Fruit*>(nullptr));
|
||||
}
|
||||
|
||||
void FixedSizedStructArrayKeyInStructTest() {
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
std::vector<Grain> grains;
|
||||
uint8_t test_char_array1[3] = { 'u', 's', 'a' };
|
||||
uint8_t test_char_array2[3] = { 'c', 'h', 'n' };
|
||||
uint8_t test_char_array3[3] = { 'c', 'h', 'l' };
|
||||
uint8_t test_char_array4[3] = { 'f', 'r', 'a' };
|
||||
uint8_t test_char_array5[3] = { 'i', 'n', 'd' };
|
||||
uint8_t test_char_array6[3] = { 'i', 't', 'a' };
|
||||
uint8_t test_char_array1[3] = {'u', 's', 'a'};
|
||||
uint8_t test_char_array2[3] = {'c', 'h', 'n'};
|
||||
uint8_t test_char_array3[3] = {'c', 'h', 'l'};
|
||||
uint8_t test_char_array4[3] = {'f', 'r', 'a'};
|
||||
uint8_t test_char_array5[3] = {'i', 'n', 'd'};
|
||||
uint8_t test_char_array6[3] = {'i', 't', 'a'};
|
||||
|
||||
Rice test_rice_array1[3] = {
|
||||
Rice(flatbuffers::make_span(test_char_array1), 2),
|
||||
Rice(flatbuffers::make_span(test_char_array2), 1),
|
||||
Rice(flatbuffers::make_span(test_char_array3), 2)
|
||||
};
|
||||
Rice(flatbuffers::make_span(test_char_array1), 2),
|
||||
Rice(flatbuffers::make_span(test_char_array2), 1),
|
||||
Rice(flatbuffers::make_span(test_char_array3), 2)};
|
||||
Rice test_rice_array2[3] = {
|
||||
Rice(flatbuffers::make_span(test_char_array4), 2),
|
||||
Rice(flatbuffers::make_span(test_char_array5), 1),
|
||||
Rice(flatbuffers::make_span(test_char_array6), 2)
|
||||
};
|
||||
Rice(flatbuffers::make_span(test_char_array4), 2),
|
||||
Rice(flatbuffers::make_span(test_char_array5), 1),
|
||||
Rice(flatbuffers::make_span(test_char_array6), 2)};
|
||||
Rice test_rice_array3[3] = {
|
||||
Rice(flatbuffers::make_span(test_char_array4), 2),
|
||||
Rice(flatbuffers::make_span(test_char_array6), 1),
|
||||
Rice(flatbuffers::make_span(test_char_array1), 2)
|
||||
};
|
||||
Rice(flatbuffers::make_span(test_char_array4), 2),
|
||||
Rice(flatbuffers::make_span(test_char_array6), 1),
|
||||
Rice(flatbuffers::make_span(test_char_array1), 2)};
|
||||
|
||||
grains.push_back(Grain(flatbuffers::make_span(test_rice_array1), 3));
|
||||
grains.push_back(Grain(flatbuffers::make_span(test_rice_array2), 1));
|
||||
@@ -196,7 +193,7 @@ void FixedSizedStructArrayKeyInStructTest() {
|
||||
|
||||
auto orc = foo_builder.Finish();
|
||||
fbb.Finish(orc);
|
||||
uint8_t *buf = fbb.GetBufferPointer();
|
||||
uint8_t* buf = fbb.GetBufferPointer();
|
||||
auto foo_table = GetFooTable(buf);
|
||||
|
||||
auto sorted_grain_vec = foo_table->h();
|
||||
@@ -207,13 +204,12 @@ void FixedSizedStructArrayKeyInStructTest() {
|
||||
sorted_grain_vec->LookupByKey(&flatbuffers::CastToArray(test_rice_array1))
|
||||
->tag(),
|
||||
3);
|
||||
Rice test_rice_array[3] = { Rice(flatbuffers::make_span(test_char_array3), 2),
|
||||
Rice(flatbuffers::make_span(test_char_array2), 1),
|
||||
Rice(flatbuffers::make_span(test_char_array1),
|
||||
2) };
|
||||
Rice test_rice_array[3] = {Rice(flatbuffers::make_span(test_char_array3), 2),
|
||||
Rice(flatbuffers::make_span(test_char_array2), 1),
|
||||
Rice(flatbuffers::make_span(test_char_array1), 2)};
|
||||
TEST_EQ(
|
||||
sorted_grain_vec->LookupByKey(&flatbuffers::CastToArray(test_rice_array)),
|
||||
static_cast<const Grain *>(nullptr));
|
||||
static_cast<const Grain*>(nullptr));
|
||||
TEST_EQ(
|
||||
sorted_grain_vec->LookupByKey(&flatbuffers::CastToArray(test_rice_array1))
|
||||
->tag(),
|
||||
|
||||
Reference in New Issue
Block a user