mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-10 23:17:27 +00:00
flatc can now convert flatbuffer binary files into json.
Also removed it appending _wire to filenames, renamed the json golden file to .golden to not clash with generated files. Bug: 15781201 Change-Id: I8322861e50d1e5b6a5ab5e4b5e5d8ae13c356eb2 Tested: on Windows and Linux
This commit is contained in:
@@ -26,7 +26,7 @@ class JavaTest {
|
||||
// This file was generated from monsterdata_test.json
|
||||
|
||||
byte[] data = null;
|
||||
File file = new File("monsterdata_test_wire.bin");
|
||||
File file = new File("monsterdata_test.bin");
|
||||
RandomAccessFile f = null;
|
||||
try {
|
||||
f = new RandomAccessFile(file, "r");
|
||||
|
||||
0
tests/monsterdata_test_wire.bin → tests/monsterdata_test.bin
Executable file → Normal file
0
tests/monsterdata_test_wire.bin → tests/monsterdata_test.bin
Executable file → Normal file
36
tests/monsterdata_test.golden
Normal file
36
tests/monsterdata_test.golden
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
pos: {
|
||||
x: 1,
|
||||
y: 2,
|
||||
z: 3,
|
||||
test1: 3,
|
||||
test2: 4,
|
||||
test3: {
|
||||
a: 5,
|
||||
b: 6
|
||||
}
|
||||
},
|
||||
hp: 80,
|
||||
name: "MyMonster",
|
||||
inventory: [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
],
|
||||
test_type: 1,
|
||||
test: {
|
||||
hp: 20
|
||||
},
|
||||
test4: [
|
||||
{
|
||||
a: 10,
|
||||
b: 20
|
||||
},
|
||||
{
|
||||
a: 30,
|
||||
b: 40
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -181,7 +181,7 @@ void ParseAndGenerateTextTest() {
|
||||
TEST_EQ(flatbuffers::LoadFile(
|
||||
"tests/monster_test.fbs", false, &schemafile), true);
|
||||
TEST_EQ(flatbuffers::LoadFile(
|
||||
"tests/monsterdata_test.json", false, &jsonfile), true);
|
||||
"tests/monsterdata_test.golden", false, &jsonfile), true);
|
||||
|
||||
// parse schema first, so we can use it to parse the data after
|
||||
flatbuffers::Parser parser;
|
||||
|
||||
Reference in New Issue
Block a user