<commit_before>//! Utilities not directly related to parsing, lexing, or
//! language-manipulation.

/// Panic with a given message unless an expression evaluates to true.
///
/// ## Examples
/// ```rust
/// # #[macro_use] extern crate cripes;
/// # fn main() {
/// panic_unless!(1 + 1 == 2, "Math is broken.");
/// # }
/// ```
///
/// ```rust,should_panic
/// # #[macro_use] extern crate cripes;
/// # fn main() {
/// panic_unless!(true == false, "I'm broken.");
/// # }
/// ```
#[macro_export]
macro_rules! panic_unless {
    ($condition:expr, $($rest:expr),+) => ({ if ! $condition { panic!($($rest),+); } });
}


pub mod set;
pub mod hash;
pub mod flex_box;
pub mod graph;
pub mod splitvec;<commit_msg>util: macro `panic_unless_eq` already used in tests, might as well add it<commit_after>//! Utilities not directly related to parsing, lexing, or
//! language-manipulation.

/// Panic with a given message unless an expression evaluates to true.
///
/// ## Examples
/// ```rust
/// # #[macro_use] extern crate cripes;
/// # fn main() {
/// panic_unless!(1 + 1 == 2, "Math is broken.");
/// # }
/// ```
///
/// ```rust,should_panic
/// # #[macro_use] extern crate cripes;
/// # fn main() {
/// panic_unless!(true == false, "I'm broken.");
/// # }
/// ```
#[macro_export]
macro_rules! panic_unless {
    ($condition:expr, $($rest:expr),+) => ({ if ! $condition { panic!($($rest),+); } });
}

/// Panic with a given message unless an expression evaluates to true.
#[macro_export]
macro_rules! panic_unless_eq {
    ($expected: expr, $actual: expr) => ({
        match (&$expected, &$actual) {
            (expected, actual) => if !(*actual == *expected) {
                panic!("unexpected value: `{:?}`, expected `{:?}`", actual, expected)
            }
        }
    });
    ($expected: expr, $actual: expr, $($rest:expr),+) => ({
        match (&$expected, &$actual) {
            (expected, actual) => if !(*actual == *expected) {
                panic!("{}: `{:?}`, expected `{:?}`", format_args!($($rest),+), actual, expected)
            }
        }
    })
}

pub mod set;
pub mod hash;
pub mod flex_box;
pub mod graph;
pub mod splitvec;
{'fraction_non_alphanumeric': 0.22320596458527492, 'fraction_numerical': 0.0027958993476234857, 'mean_word_length': 2.8067375886524824, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '58913', 'n_tokens_mistral': 721, 'n_tokens_neox': 699, 'n_words': 197}