mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +00:00
This commit is contained in:
@@ -591,7 +591,17 @@ class JavaTest {
|
||||
public static void testFlexBuffersTest() {
|
||||
FlexBuffersBuilder builder = new FlexBuffersBuilder(ByteBuffer.allocate(512),
|
||||
FlexBuffersBuilder.BUILDER_FLAG_SHARE_KEYS_AND_STRINGS);
|
||||
testFlexBuffersTest(builder);
|
||||
int bufferLimit1 = ((ArrayReadWriteBuf) builder.getBuffer()).limit();
|
||||
|
||||
// Repeat after clearing the builder to ensure the builder is reusable
|
||||
builder.clear();
|
||||
testFlexBuffersTest(builder);
|
||||
int bufferLimit2 = ((ArrayReadWriteBuf) builder.getBuffer()).limit();
|
||||
TestEq(bufferLimit1, bufferLimit2);
|
||||
}
|
||||
|
||||
public static void testFlexBuffersTest(FlexBuffersBuilder builder) {
|
||||
// Write the equivalent of:
|
||||
// { vec: [ -100, "Fred", 4.0, false ], bar: [ 1, 2, 3 ], bar3: [ 1, 2, 3 ],
|
||||
// foo: 100, bool: true, mymap: { foo: "Fred" } }
|
||||
|
||||
Reference in New Issue
Block a user