mirror of
https://gitee.com/openharmony/third_party_rust_nom
synced 2025-02-24 17:51:23 +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))
|
||||
));
|
||||
|
||||
/*
|
||||
|
||||
#[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"))));
|
||||
}
|
||||
|
||||
#[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)")) ));
|
||||
}
|
||||
|
||||
#[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))")) ));
|
||||
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)")) ));
|
||||
assert_eq!(expr(&b" 72 / 2 / 3 "[..]).map(|x| format!("{:?}", x)),
|
||||
Ok( (&b""[..], String::from("((72 / 2)) / 3)")) ));
|
||||
assert_eq!(expr(&b" 72 / 2 / 3 "[..]).map(|(i,x)| (i,format!("{:?}", x))),
|
||||
Ok( (&b""[..], String::from("((72 / 2) / 3)")) ));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parens_test() {
|
||||
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)")) )
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user