# Mutation Testing Configuration for CDK
# Phase 1: Focus on cashu crate only

# Start with cashu crate only - exclude other crates initially
exclude_globs = [
    "crates/cdk-*/**",  # Exclude other crates initially
    "**/tests/**",      # Don't mutate test code
    "**/benches/**",    # Don't mutate benchmarks
]

# Reasonable timeout to catch hangs (5 minutes minimum)
minimum_test_timeout = 300

# Skip specific mutations that cause infinite loops
# These mutations create scenarios where loops never terminate or recursive functions never return.
# Format: "file.rs:line.*pattern"
exclude_re = [
    # dhke.rs:61 - Mutating counter += to *= causes infinite loop (counter stays 0)
    "crates/cashu/src/dhke.rs:61:.*replace \\+= with \\*=",

    # amount.rs:108 - Mutating % to / in split causes infinite loop
    "crates/cashu/src/amount.rs:108:.*replace % with /",

    # amount.rs:100 - split() returning empty vec causes infinite loops
    "crates/cashu/src/amount.rs:100:.*replace.*split.*with vec!\\[\\]",
    "crates/cashu/src/amount.rs:100:.*replace.*split.*with vec!\\[Default",

    # amount.rs:203 - checked_add returning Some(Default/0) causes infinite increment loops
    "crates/cashu/src/amount.rs:203:.*replace.*checked_add.*with Some\\(Default",

    # amount.rs:226 - try_sum returning Ok(Default/0) causes infinite loops
    "crates/cashu/src/amount.rs:226:.*replace.*try_sum.*with Ok\\(Default",

    # amount.rs:288 - From<u64> returning Default/0 causes infinite loops
    "crates/cashu/src/amount.rs:288:.*replace.*from.*with Default",

    # amount.rs:331 - Sub returning Default/0 causes infinite loops
    "crates/cashu/src/amount.rs:331:.*replace.*sub.*with Default",

    # Trivial getters/setters - not worth testing
    "FeeAndAmounts::fee",
    "FeeAndAmounts::amounts",
    "BlindedMessage::witness",
    "crates/cashu/src/amount.rs:.*to_u64",

    # Trivial trait implementations - unrealistic mutations
    "crates/cashu/src/amount.rs.*impl From<&u64> for Amount.*from",
    "crates/cashu/src/amount.rs.*impl AsRef<u64> for Amount.*as_ref",
    "crates/cashu/src/amount.rs.*impl std::ops::Mul for Amount.*mul",
    "crates/cashu/src/amount.rs.*impl std::ops::Div for Amount.*div",
    "crates/cashu/src/amount.rs.*impl From<Amount> for u64.*from",
    "crates/cashu/src/amount.rs.*impl Default for Amount",
    "crates/cashu/src/amount.rs.*impl Default for &Amount",
    "crates/cashu/src/amount.rs.*impl.*Display for Amount.*fmt",

    # amount_for_offer requires constructing lightning Offer objects which is complex
    "crates/cashu/src/amount.rs.*amount_for_offer",

    # hash_to_curve boundary check - would require finding a message that needs exactly 2^16
    # iterations which is impractical. The < vs <= mutation is not realistically testable.
    "crates/cashu/src/dhke.rs:49:.*replace < with",

    # Secret::drop zeroizes memory for security. Testing this properly requires unsafe memory
    # inspection. The security guarantee comes from using the zeroize crate correctly.
    "crates/cashu/src/secret.rs.*impl Drop for Secret.*drop",

    # serialize_to_cbor_diag is only used for CLI diagnostic output (decode_token, decode_request).
    # Not part of any critical path - purely human-readable debugging output.
    "crates/cashu/src/util/mod.rs.*serialize_to_cbor_diag",

    # PartialOrd canonical implementation - just delegates to Ord::cmp, this is standard Rust idiom
    "crates/cashu/src/nuts/nut00/mod.rs.*impl PartialOrd for Proof.*partial_cmp",
]
