Skip to main content

bcore_mutation/
lib.rs

1//! # Mutation Core
2//!
3//! A mutation testing tool for Bitcoin Core written in Rust.
4//!
5//! This library provides functionality to:
6//! - Generate mutants for Bitcoin Core source code
7//! - Analyze mutants by running tests against them
8//! - Generate detailed reports of surviving mutants
9//! - AST-based arid node detection to filter unproductive mutants
10//!
11//! ## Example
12//!
13//! ```rust,no_run
14//! use bcore_mutation::mutation;
15//! use bcore_mutation::project::Project;
16//! use std::collections::HashMap;
17//!
18//! #[tokio::main]
19//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
20//!     // Generate mutants for a specific file with AST filtering
21//!     mutation::run_mutation(
22//!         Project::BitcoinCore,        // project
23//!         None,                        // PR number
24//!         Some("src/test.cpp".into()), // file path
25//!         false,                       // one_mutant
26//!         false,                       // only_security_mutations
27//!         None,                        // range_lines
28//!         None,                        // coverage
29//!         false,                       // test_only
30//!         HashMap::new(),              // skip_lines
31//!         true,                        // enable_ast_filtering
32//!         None,                        // custom_expert_rule
33//!         None,                        // sqlite_path
34//!     ).await?;
35//!
36//!     Ok(())
37//! }
38//! ```
39
40pub mod analyze;
41pub mod ast_analysis;
42pub mod commands;
43pub mod coverage;
44pub mod db;
45pub mod error;
46pub mod git_changes;
47pub mod mutation;
48pub mod operators;
49pub mod project;
50pub mod report;
51
52pub use error::{MutationError, Result};
53
54/// Re-export commonly used types
55pub mod prelude {
56    pub use crate::analyze::run_analysis;
57    pub use crate::ast_analysis::{AridNodeDetector, AstNode, AstNodeType};
58    pub use crate::coverage::parse_coverage_file;
59    pub use crate::error::{MutationError, Result};
60    pub use crate::mutation::run_mutation;
61}