Skip to main content

Module diff_test

Module diff_test 

Source
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§

DiffTestConfig
Configuration for differential testing.
DiffTestResult
Result of a differential test comparing C and Rust execution.
ExecutionOutput
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.