fn stringify_conds<'cd>(ast: AstNode<'cd, StringAst>) -> AstNodeC<String, String, String> {
    use self::AstNodeC::*;
    use self::LoopType::*;

    match ast {
        BasicBlock(b) => BasicBlock(b),
        Seq(seq) => Seq(seq.into_iter().map(stringify_conds).collect()),
        Cond(c, t, oe) => Cond(
            format!("{:?}", c),
            Box::new(stringify_conds(*t)),
            oe.map(|e| Box::new(stringify_conds(*e))),
        ),
        Loop(PreChecked(c), b) => Loop(
            PreChecked(format!("{:?}", c)),
            Box::new(stringify_conds(*b)),
        ),
        Loop(PostChecked(c), b) => Loop(
            PostChecked(format!("{:?}", c)),
            Box::new(stringify_conds(*b)),
        ),
        Loop(Endless, b) => Loop(Endless, Box::new(stringify_conds(*b))),
        Break => Break,
        Switch(v, cases, default) => Switch(
            v,
            cases
                .into_iter()
                .map(|(vs, a)| (vs, stringify_conds(a)))
                .collect(),
            Box::new(stringify_conds(*default)),
        ),
    }
}
/// note that this makes the test more fragile as it becomes sensitive to the
/// exact internal representation of conditions
note that this makes the test more fragile as it becomes sensitive to the
exact internal representation of conditions
note that this makes the test more fragile as it becomes sensitive to the exact internal representation of conditions
fn stringify_conds<'cd>(ast: AstNode<'cd, StringAst>) -> AstNodeC<String, String, String> {
    use self::AstNodeC::*;
    use self::LoopType::*;
    match ast {
        BasicBlock(b) => BasicBlock(b),
        Seq(seq) => Seq(seq.into_iter().map(stringify_conds).collect()),
        Cond(c, t, oe) => Cond(
            format!("{:?}", c),
            Box::new(stringify_conds(*t)),
            oe.map(|e| Box::new(stringify_conds(*e))),
        ),
        Loop(PreChecked(c), b) => Loop(
            PreChecked(format!("{:?}", c)),
            Box::new(stringify_conds(*b)),
        ),
        Loop(PostChecked(c), b) => Loop(
            PostChecked(format!("{:?}", c)),
            Box::new(stringify_conds(*b)),
        ),
        Loop(Endless, b) => Loop(Endless, Box::new(stringify_conds(*b))),
        Break => Break,
        Switch(v, cases, default) => Switch(
            v,
            cases
                .into_iter()
                .map(|(vs, a)| (vs, stringify_conds(a)))
                .collect(),
            Box::new(stringify_conds(*default)),
        ),
    }
}
fn stringify_conds < ' cd > ( ast : AstNode < ' cd , StringAst > ) -> AstNodeC < String , String , String > { use self :: AstNodeC :: * ; use self :: LoopType :: * ; match ast { BasicBlock ( b ) => BasicBlock ( b ) , Seq ( seq ) => Seq ( seq . into_iter ( ) . map ( stringify_conds ) . collect ( ) ) , Cond ( c , t , oe ) => Cond ( format ! ( " " c ) , Box :: new ( stringify_conds ( * t ) ) , oe . map ( | e | Box :: new ( stringify_conds ( * e ) ) ) , ) , Loop ( PreChecked ( c ) , b ) => Loop ( PreChecked ( format ! ( " " c ) ) , Box :: new ( stringify_conds ( * b ) ) , ) , Loop ( PostChecked ( c ) , b ) => Loop ( PostChecked ( format ! ( " " c ) ) , Box :: new ( stringify_conds ( * b ) ) , ) , Loop ( Endless , b ) => Loop ( Endless , Box :: new ( stringify_conds ( * b ) ) ) , Break => Break , Switch ( v , cases , default ) => Switch ( v , cases . into_iter ( ) . map ( | ( vs , a ) | ( vs , stringify_conds ( a ) ) ) . collect ( ) , Box :: new ( stringify_conds ( * default ) ) , ) , } }
note that this makes the test more fragile as it becomes sensitive to the
exact internal representation of conditions
note that this makes the test more fragile as it becomes sensitive to the exact internal representation of conditions
ast
AstNode<'cd, StringAst>
ast
AstNode<'cd, StringAst>