mirror of
https://gitee.com/openharmony/third_party_rust_nom
synced 2025-02-25 02:00:43 +00:00
reactivate unit tests for arithmetic_ast
This commit is contained in:
parent
08a8a67df0
commit
8ed37f75a3
@ -108,34 +108,34 @@ named!(expr< Expr >, do_parse!(
|
|||||||
(fold_exprs(initial, remainder))
|
(fold_exprs(initial, remainder))
|
||||||
));
|
));
|
||||||
|
|
||||||
/*
|
|
||||||
#[test]
|
#[test]
|
||||||
fn factor_test() {
|
fn factor_test() {
|
||||||
assert_eq!(factor(&b" 3 "[..]).map(|x| format!("{:?}", x)),
|
assert_eq!(factor(&b" 3 "[..]).map(|(i,x)| (i,format!("{:?}", x))),
|
||||||
Ok((&b""[..], String::from("3"))));
|
Ok((&b""[..], String::from("3"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn term_test() {
|
fn term_test() {
|
||||||
assert_eq!(term(&b" 3 * 5 "[..]).map(|x| format!("{:?}", x)),
|
assert_eq!(term(&b" 3 * 5 "[..]).map(|(i,x)| (i,format!("{:?}", x))),
|
||||||
Ok( (&b""[..], String::from("(3 * 5)")) ));
|
Ok( (&b""[..], String::from("(3 * 5)")) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn expr_test() {
|
fn expr_test() {
|
||||||
assert_eq!(expr(&b" 1 + 2 * 3 "[..]).map(|x| format!("{:?}", x)),
|
assert_eq!(expr(&b" 1 + 2 * 3 "[..]).map(|(i,x)| (i,format!("{:?}", x))),
|
||||||
Ok( (&b""[..], String::from("(1 + (2 * 3))")) ));
|
Ok( (&b""[..], String::from("(1 + (2 * 3))")) ));
|
||||||
assert_eq!(expr(&b" 1 + 2 * 3 / 4 - 5 "[..]).map(|x| format!("{:?}", x)),
|
assert_eq!(expr(&b" 1 + 2 * 3 / 4 - 5 "[..]).map(|(i,x)| (i,format!("{:?}", x))),
|
||||||
Ok( (&b""[..], String::from("((1 + ((2 * 3) / 4)) - 5)")) ));
|
Ok( (&b""[..], String::from("((1 + ((2 * 3) / 4)) - 5)")) ));
|
||||||
assert_eq!(expr(&b" 72 / 2 / 3 "[..]).map(|x| format!("{:?}", x)),
|
assert_eq!(expr(&b" 72 / 2 / 3 "[..]).map(|(i,x)| (i,format!("{:?}", x))),
|
||||||
Ok( (&b""[..], String::from("((72 / 2)) / 3)")) ));
|
Ok( (&b""[..], String::from("((72 / 2) / 3)")) ));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parens_test() {
|
fn parens_test() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
expr(&b" ( 1 + 2 ) * 3 "[..]).map(|x| format!("{:?}", x)),
|
expr(&b" ( 1 + 2 ) * 3 "[..]).map(|(i,x)| (i,format!("{:?}", x))),
|
||||||
Ok( (&b""[..], String::from("([(1 + 2)] * 3)")) )
|
Ok( (&b""[..], String::from("([(1 + 2)] * 3)")) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user