]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_data_structures/src/fingerprint/tests.rs
Merge commit 'd0cf3481a84e3aa68c2f185c460e282af36ebc42' into clippyup
[rust.git] / compiler / rustc_data_structures / src / fingerprint / tests.rs
1 use super::*;
2
3 // Check that `combine_commutative` is order independent.
4 #[test]
5 fn combine_commutative_is_order_independent() {
6     let a = Fingerprint::new(0xf6622fb349898b06, 0x70be9377b2f9c610);
7     let b = Fingerprint::new(0xa9562bf5a2a5303c, 0x67d9b6c82034f13d);
8     let c = Fingerprint::new(0x0d013a27811dbbc3, 0x9a3f7b3d9142ec43);
9     let permutations = [(a, b, c), (a, c, b), (b, a, c), (b, c, a), (c, a, b), (c, b, a)];
10     let f = a.combine_commutative(b).combine_commutative(c);
11     for p in &permutations {
12         assert_eq!(f, p.0.combine_commutative(p.1).combine_commutative(p.2));
13     }
14 }