()
| 278 | |
| 279 | #[test] |
| 280 | fn score_bound_vs_unbound() { |
| 281 | let csr = social_graph(); |
| 282 | |
| 283 | let triple = PatternTriple { |
| 284 | src: NodeBinding { |
| 285 | name: Some("a".into()), |
| 286 | label: None, |
| 287 | }, |
| 288 | edge: EdgeBinding { |
| 289 | name: None, |
| 290 | edge_type: Some("KNOWS".into()), |
| 291 | direction: EdgeDirection::Right, |
| 292 | min_hops: 1, |
| 293 | max_hops: 1, |
| 294 | }, |
| 295 | dst: NodeBinding { |
| 296 | name: Some("b".into()), |
| 297 | label: None, |
| 298 | }, |
| 299 | }; |
| 300 | |
| 301 | let mut bound = std::collections::HashSet::new(); |
| 302 | let unbound_score = score_triple(&triple, &csr, &bound); |
| 303 | |
| 304 | bound.insert("a".to_string()); |
| 305 | let one_bound_score = score_triple(&triple, &csr, &bound); |
| 306 | |
| 307 | bound.insert("b".to_string()); |
| 308 | let both_bound_score = score_triple(&triple, &csr, &bound); |
| 309 | |
| 310 | assert!(one_bound_score < unbound_score); |
| 311 | assert!(both_bound_score < one_bound_score); |
| 312 | } |
| 313 | |
| 314 | #[test] |
| 315 | fn score_variable_length_penalized() { |
nothing calls this directly
no test coverage detected