Rustgen is a random program that can generate correct runnable Rust programs along with the expected output of the program. It's primary purpose is to find compiler bugs either through comparing the output of running the test program with the expected output, or through differential testing.
Clone the project
git clone https://github.com/lukyxu/rust-gen
Go to the project directory
cd rust-gen
Build and run RustGen Generate
cargo run --bin --release rust-gen-generate
Build and run RustGen Runner for 100 programs and saving all outputs including generated code and binaries.
cargo run --bin rust-gen-runner --release -- -n 100 -s
To run tests, run the following command
cargo test
Rust Gen creates programs with the following features:
Primitive types
Feature | Status |
---|---|
Int (all) | 🟢 |
UInt (all) | 🟢 |
Bool | 🟢 |
Char | 🔴 |
String | 🔴 |
Float | 🔴 |
Composite types
Feature | Status |
---|---|
Tuple | 🟢 |
Array | 🟢 |
Box | 🔴 |
Reference | 🟢 |
Enum | 🔴 |
Struct | 🟢 |
Statements
Feature | Status |
---|---|
Local Declaration | 🟢 |
Local Initialization | 🔴 |
Expression | 🟢 |
Semicolon | 🟢 |
Item | 🟡 |
Expressions
Feature | Status |
---|---|
Literal | 🟢 |
Binary | 🟢 |
Unary | 🟢 |
Cast | 🟢 |
If | 🟢 |
Block | 🟢 |
Ident | 🟢 |
Tuple | 🟢 |
Assign | 🟢 |
Call (Function) | 🟢 |
Call (Method) | 🔴 |
Type (Ascription) | 🔴 |
While | 🔴 |
For Loop | 🔴 |
Loop | 🔴 |
Match | 🔴 |
Field | 🟢 |
Index | 🟢 |
Address Of | 🟢 |
Repeat (Array) | 🔴 |
Struct | 🟢 |
Binary Operations
Feature | Status |
---|---|
Add | 🟢 |
Sub | 🟢 |
Mul | 🟢 |
Div | 🟢 |
Rem | 🟢 |
And | 🟢 |
Or | 🟢 |
BitXor | 🟢 |
BitAnd | 🟢 |
BitOr | 🟢 |
Shl | 🔴 |
Shr | 🔴 |
Eq | 🟢 |
Lq | 🟢 |
Ne | 🟢 |
Ge | 🟢 |
Gt | 🟢 |
WrappingAdd | 🟢 |
WrappingSub | 🟢 |
WrappingMul | 🟢 |
WrappingDiv | 🟢 |
WrappingRem | 🟢 |
WrappingShl | 🟢 |
WrappingShr | 🟢 |
Unary Operations
Feature | Status |
---|---|
Deref | 🟢 |
Not | 🟢 |
Neg | 🟢 |