You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: backtracking.rs
    path of file: ./repos/argmin/crates/argmin/src/solver/linesearch
    
    the code of the file until where you have to start completion: // Copyright 2018-2024 argmin developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.

use crate::core::{
    ArgminFloat, CostFunction, Error, Gradient, IterState, LineSearch, Problem, Solver, State,
    TerminationReason, TerminationStatus, KV,
};
use crate::solver::linesearch::condition::*;
use argmin_math::ArgminScaledAdd;
#[cfg(feature = "serde1")]
use serde::{Deserialize, Serialize};

/// # Backtracking line search
///
/// The Backtracking line search is a method which finds a step length from a given point along a
/// given direction, such that this step length obeys the Armijo (sufficient decrease) condition.
///
/// ## Requirements on the optimization problem
///
/// The optimization problem is required to implement [`CostFunction`] and [`Gradient`].
///
/// ## References
///
/// Jorge Nocedal and Stephen J. Wright (2006). Numerical Optimization.
/// Springer. ISBN 
    
    fn test_termination() {
        let c: f64 = 0.01;
        let armijo = ArmijoCondition::new(c).unwrap();
        let mut ls: BacktrackingLineSearch<Vec<f64>, Vec<f64>, ArmijoCondition<f64>, f64> =
            BacktrackingLineSearch::new(armijo);

        let init_alpha = 0.8;
        ls.init_param = Some(vec![-1.0, 0.0]);
        ls.init_cost = f64::infinity();
        ls.init_grad = Some(vec![-2.0, 0.0]);
        ls.search_direction(vec![2.0f64, 0.0]);
        ls.initial_step_length(init_alpha).unwrap();

        let init_param = ls.init_param.clone().unwrap();
        assert_eq!(
            <BacktrackingLineSearch<Vec<f64>, Vec<f64>, ArmijoCondition<f64>, f64> as Solver<
                TestProblem,
                IterState<Vec<f64>, Vec<f64>, (), (), (), f64>,
            >>::terminate(
                &mut ls,
                &IterState::<Vec<f64>, Vec<f64>, (), (), (), f64>::new().param(init_param)
            ),
            TerminationStatus::Terminated(TerminationReason::SolverConverged)
        );

        ls.init_cost = 0.0f64;

        let init_param = ls.init_param.clone().unwrap();
        assert_eq!(
            <BacktrackingLineSearch<Vec<f64>, Vec<f64>, ArmijoCondition<f64>, f64> as Solver<
                TestProblem,
                IterState<Vec<f64>, Vec<f64>, (), (), (), f64>,
            >>::terminate(
                &mut ls,
                &IterState::<Vec<f64>, Vec<f64>, (), (), (), f64>::new().param(init_param)
            ),
            TerminationStatus::NotTerminated
        );
    }