mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-16 17:22:21 +00:00
[C++] Adds basic schema evolution tests (#5611)
* Added basic schema evolution tests * Add BUILD targets for evolution tests. Added to test/generate_code scripts * Use vector.front() instead of vector.data() * Added --scoped-enums option for evolution test
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
adbcbba5d1
commit
dda095023d
50
tests/evolution_test/evolution_v2.fbs
Normal file
50
tests/evolution_test/evolution_v2.fbs
Normal file
@@ -0,0 +1,50 @@
|
||||
namespace Evolution.V2;
|
||||
|
||||
table TableA {
|
||||
b:int (id: 1); // swapped with 'a'
|
||||
a:float (id: 0); // swapped with 'b'
|
||||
c:string (id: 2); // new in v2
|
||||
}
|
||||
|
||||
table TableB {
|
||||
a:int;
|
||||
}
|
||||
|
||||
table TableC { // new in v2
|
||||
a:double;
|
||||
b:string;
|
||||
}
|
||||
|
||||
enum Enum : byte {
|
||||
King,
|
||||
Queen,
|
||||
Rook, // new in v2
|
||||
Bishop // new in v2
|
||||
}
|
||||
|
||||
union Union {
|
||||
TableA,
|
||||
TableB,
|
||||
TableC
|
||||
}
|
||||
|
||||
struct Struct {
|
||||
a:int;
|
||||
b:double;
|
||||
}
|
||||
|
||||
table Root {
|
||||
a:int (deprecated); // deprecated in v2
|
||||
b:bool;
|
||||
c:Union;
|
||||
d:Enum;
|
||||
e:TableA;
|
||||
ff:Struct; // renamed from 'f' in v1
|
||||
g:[int];
|
||||
h:[TableB];
|
||||
i:uint = 1234;
|
||||
j:TableC; // new in v2
|
||||
k:uint8 = 56; // new in v2
|
||||
}
|
||||
|
||||
root_type Root;
|
||||
Reference in New Issue
Block a user