chromium/third_party/flatbuffers/src/tests/test_builder.h

#ifndef TEST_BUILDER_H
#define TEST_BUILDER_H

#include <set>
#include <type_traits>

#include "flatbuffers/flatbuffers.h"
#include "monster_test_generated.h"
#include "test_assert.h"

Color;
Monster;

namespace flatbuffers {
namespace grpc {
class MessageBuilder;
}
}  // namespace flatbuffers

inline std::string m1_name() {}
inline std::string m2_name() {}
inline MyGame::Example::Color m1_color() {}
inline MyGame::Example::Color m2_color() {}
inline void m1_color_check() {}

flatbuffers::Offset<Monster> populate1(flatbuffers::FlatBufferBuilder &builder);
flatbuffers::Offset<Monster> populate2(flatbuffers::FlatBufferBuilder &builder);

uint8_t *release_raw_base(flatbuffers::FlatBufferBuilder &fbb, size_t &size,
                          size_t &offset);

void free_raw(flatbuffers::grpc::MessageBuilder &mbb, uint8_t *buf);
void free_raw(flatbuffers::FlatBufferBuilder &fbb, uint8_t *buf);

bool verify(const flatbuffers::DetachedBuffer &buf,
            const std::string &expected_name, Color color);
bool verify(const uint8_t *buf, size_t offset, const std::string &expected_name,
            Color color);

bool release_n_verify(flatbuffers::FlatBufferBuilder &fbb,
                      const std::string &expected_name, Color color);
bool release_n_verify(flatbuffers::grpc::MessageBuilder &mbb,
                      const std::string &expected_name, Color color);

// Invokes this function when testing the following Builder types
// FlatBufferBuilder, TestHeapBuilder, and GrpcLikeMessageBuilder
template<class Builder>
void builder_move_assign_after_releaseraw_test(Builder b1) {}

void builder_move_assign_after_releaseraw_test(
    flatbuffers::grpc::MessageBuilder b1);

template<class DestBuilder, class SrcBuilder = DestBuilder>
struct BuilderTests {};

enum BuilderReuseTestSelector {};

TestSelector;

template<class DestBuilder, class SrcBuilder> struct BuilderReuseTests {};

#endif  // TEST_BUILDER_H