[fuzzer] Adds code generation target. (#8795)

* adds code generation fuzzer target.

* add buffer verification

* add table verification in codegen fuzzer

---------

Co-authored-by: Björn Harrtell <bjornharrtell@users.noreply.github.com>
This commit is contained in:
coder7695
2025-11-27 16:52:28 +01:00
committed by GitHub
parent 84f4b83d3e
commit 2b107e20c5
13 changed files with 495 additions and 10 deletions

View File

@@ -0,0 +1,11 @@
attribute "csharp_namespace";
namespace Test;
table Data (csharp_partial) {
value:int;
}
root_type Data;
file_identifier "TEST";

View File

@@ -0,0 +1,24 @@
namespace Example;
enum Status:byte { Active, Inactive, Pending }
struct Point {
x:int;
y:int;
}
table User {
id:uint;
name:string;
points:[Point];
status:Status = Active;
metadata:[string];
}
table Group {
name:string;
users:[User];
leader:User;
}
root_type Group;

View File

@@ -0,0 +1,6 @@
table Person {
name:string;
age:int;
}
root_type Person;

View File

@@ -0,0 +1,8 @@
enum Color:byte { Red, Green, Blue }
table Item {
name:string;
color:Color;
}
root_type Item;

View File

@@ -0,0 +1,33 @@
// Example IDL file for our monster's schema.
namespace MyGame.Sample;
enum Color:byte { Red = 0, Green, Blue = 2 }
union Equipment { Weapon } // Optionally add more tables.
struct Vec3 {
x:float;
y:float;
z:float;
}
table Monster {
pos:Vec3;
mana:short = 150;
hp:short = 100;
name:string;
friendly:bool = false (deprecated);
inventory:[ubyte];
color:Color = Blue;
weapons:[Weapon];
equipped:Equipment;
path:[Vec3];
}
table Weapon {
name:string;
damage:short;
}
root_type Monster;

View File

@@ -0,0 +1,14 @@
table Request {
id:int;
message:string;
}
table Response {
result:string;
}
rpc_service MyService {
DoSomething(Request):Response;
}
root_type Request;

View File

@@ -0,0 +1,11 @@
struct Vec2 {
x:float;
y:float;
}
table Object {
position:Vec2;
id:int;
}
root_type Object;

View File

@@ -0,0 +1,20 @@
namespace Test;
union Shape {
Circle,
Square,
}
table Circle {
radius: float;
}
table Square {
side: float;
}
table Root {
shape: Shape;
}
root_type Root;