/*
    Appellation: neural <module>
    Contrib: @FL03
*/
#[doc(inline)]
pub use self::{controller::NeuralController, engine::NeuralEngine, features::NeuralFeatures};

pub(crate) mod controller;
pub(crate) mod engine;
pub(crate) mod features;

pub(crate) mod prelude {
    pub use super::controller::NeuralController;
    pub use super::engine::NeuralEngine;
    pub use super::features::NeuralFeatures;
}

#[cfg(test)]
mod tests {

    #[test]
    #[cfg(feature = "anyhow")]
    fn test_neural_controller_fwd() -> crate::Result<()> {
        let controller = super::NeuralController::<f64>::new();
        let features = controller.features();
        // create a simple input array
        let input = ndarray::Array1::zeros(features.inputs());
        let expected = ndarray::Array1::from_elem(features.outputs(), 0.5);
        let output = controller.forward(&input)?;
        // check the dimensionality of the produced outputs
        assert_eq!(output.len(), features.outputs());
        // the output should be [0.5, ..., 0.5]
        assert_eq!(output, expected);
        Ok(())
    }
}
