// Allow dead code while developing.
#![allow(dead_code)]

mod debug;
mod graph;
mod queue;
mod types;

pub use graph::FlowGraph;

#[cfg(any(feature = "test", test))]
pub mod tracing;

pub(crate) mod internal_prelude {
    #[allow(unused_imports)]
    pub(crate) use tracing::{debug, error, info, trace, warn};
}

#[cfg(test)]
mod tests {
    use testresult::TestResult;
    use wot_search_tests::flow::{test_wot_search, test_wot_search_from_path};

    use crate::{graph::FlowGraph, tracing::install_tracing};

    /// Takes a set of custom test files in yaml format.
    /// The path to these files is declared via the `FLOW_TEST_PATH` variable.
    #[test]
    fn custom_flow_suite() -> TestResult {
        let _ = install_tracing(3);

        let path = std::env::var("FLOW_TEST_PATH");

        let Ok(path) = path else {
            return Ok(());
        };

        test_wot_search_from_path::<FlowGraph>(&path)?;

        Ok(())
    }

    /// Run all tests of the [`wot_search_tests`] crate.
    #[test]
    fn flow_suite() -> TestResult {
        let _ = install_tracing(3);

        test_wot_search::<FlowGraph>()?;

        Ok(())
    }
}
