Expand description
Differential testing against GCC semantics (S5).
Compiles original C with gcc, compiles transpiled Rust with rustc, runs both binaries, and compares stdout + exit codes to prove behavioral equivalence.
§Example
use decy_verify::diff_test::{diff_test, DiffTestConfig};
let c_code = "int main() { return 0; }";
let rust_code = "fn main() {}";
let config = DiffTestConfig::default();
let result = diff_test(c_code, rust_code, &config).unwrap();
assert!(result.stdout_matches);
assert!(result.exit_code_matches);Structs§
- Diff
Test Config - Configuration for differential testing.
- Diff
Test Result - Result of a differential test comparing C and Rust execution.
- Execution
Output - Output captured from running a compiled binary.
Functions§
- compile_
c - Compile C source code with gcc and return the temp directory + binary path.
- compile_
rust - Compile Rust source code with rustc and return the temp directory + binary path.
- diff_
test - Run a full differential test: compile C with gcc, compile Rust with rustc, execute both, and compare outputs.
- run_
binary - Run a compiled binary and capture its output.