()
| 381 | |
| 382 | #[test] |
| 383 | fn test_negotiation_savings_pct() { |
| 384 | let manifest = ChunkManifest::new(vec![ |
| 385 | ChunkManifestEntry::new(0, [0xAA; 32], 50, 100), |
| 386 | ChunkManifestEntry::new(1, [0xBB; 32], 50, 100), |
| 387 | ]); |
| 388 | |
| 389 | // Have one of two equal-size chunks → 50% savings |
| 390 | let have = vec![[0xAA; 32]]; |
| 391 | let result = ChunkNegotiation::compute(&manifest, &have); |
| 392 | assert!((result.savings_pct() - 50.0).abs() < f64::EPSILON); |
| 393 | } |
| 394 | |
| 395 | #[test] |
| 396 | fn test_negotiation_savings_pct_zero() { |
nothing calls this directly
no outgoing calls
no test coverage detected