The ctest::TestGenerator is used within a build.rs script to define how the test suite is constructed. You must provide the C header files, the include paths for those headers, and the path to the Rust source file you wish to validate.
Key methods:
.header(path): Specifies a C header file where APIs are defined..include(path): Specifies a directory containing header files.ctest::generate_test(&mut cfg, rust_src_path, output_filename): Generates the test suite, taking the configuration, the path to the *-sys library source, and the name of the Rust file to be generated.
fn main() {
let mut cfg = ctest::TestGenerator::new();
// Include the header files where the C APIs are defined
cfg.header("foo.h")
.header("bar.h");
// Include the directory where the header files are defined
cfg.include("path/to/include");
// Generate the tests, passing the path to the `*-sys` library as well as
// the module to generate.
ctest::generate_test(&mut cfg, "../mylib-sys/lib.rs", "all.rs");
}