mirror of
https://github.com/vee1e/flatbuffers.git
synced 2026-09-02 02:07:25 +00:00
This commit is contained in:
parent
e84cbff673
commit
c2da8d5d85
5 changed files with 38 additions and 0 deletions
|
|
@ -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" } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue