Test associativity of multiplication

This commit is contained in:
Patrick Lühne 2020-03-12 00:10:51 +01:00
parent 385c878597
commit 19e70a90c5
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
1 changed files with 15 additions and 0 deletions

View File

@ -576,6 +576,21 @@ mod tests
assert_eq!(e1, e2);
assert_ne!(e1, e3);
let (rest, m1) = term("1 * 2 * 3 * 4 * 5, rest", &Declarations::new()).unwrap();
assert_eq!(rest, ", rest");
assert_eq!(format!("{}", m1), "1 * 2 * 3 * 4 * 5");
let (rest, m2) = term("1 * (2 * (3 * (4 * 5))), rest", &Declarations::new()).unwrap();
assert_eq!(rest, ", rest");
assert_eq!(format!("{}", m2), "1 * 2 * 3 * 4 * 5");
let (rest, m3) = term("(((1 * 2) * 3) * 4) * 5, rest", &Declarations::new()).unwrap();
assert_eq!(rest, ", rest");
assert_eq!(format!("{}", m3), "1 * 2 * 3 * 4 * 5");
assert_eq!(m1, m2);
assert_ne!(m1, m3);
}
#[test]