()
| 217 | |
| 218 | #[test] |
| 219 | fn test_insert_intersection() { |
| 220 | // a = b, b = c, c = d |
| 221 | let mut set1 = JoinKeySet::new(); |
| 222 | set1.insert(&col("a"), &col("b")); |
| 223 | set1.insert(&col("b"), &col("c")); |
| 224 | set1.insert(&col("c"), &col("d")); |
| 225 | |
| 226 | // a = a, b = b, b = c, d = c |
| 227 | // should only intersect on b = c and c = d |
| 228 | let mut set2 = JoinKeySet::new(); |
| 229 | set2.insert(&col("a"), &col("a")); |
| 230 | set2.insert(&col("b"), &col("b")); |
| 231 | set2.insert(&col("b"), &col("c")); |
| 232 | set2.insert(&col("d"), &col("c")); |
| 233 | |
| 234 | let mut set = JoinKeySet::new(); |
| 235 | // put something in there already |
| 236 | set.insert(&col("x"), &col("y")); |
| 237 | set.insert_intersection(&set1, &set2); |
| 238 | |
| 239 | assert_contents( |
| 240 | &set, |
| 241 | vec![ |
| 242 | (&col("x"), &col("y")), |
| 243 | (&col("b"), &col("c")), |
| 244 | (&col("c"), &col("d")), |
| 245 | ], |
| 246 | ); |
| 247 | } |
| 248 | |
| 249 | fn assert_contents(set: &JoinKeySet, expected: Vec<(&Expr, &Expr)>) { |
| 250 | let contents: Vec<_> = set.iter().collect(); |
nothing calls this directly
no test coverage detected
searching dependent graphs…