Test associativity of multiplication
This commit is contained in:
parent
385c878597
commit
19e70a90c5
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user