feat(core): score by distance from target size (#63)
This commit was merged in pull request #63.
This commit is contained in:
@@ -191,6 +191,35 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn every_policy_carries_its_scoring_numbers() {
|
||||
let (_dir, db) = fresh().await;
|
||||
|
||||
let rows = sqlx::query("SELECT size_bands, score_weights FROM policies")
|
||||
.fetch_all(db.pool())
|
||||
.await
|
||||
.expect("policies");
|
||||
|
||||
assert_eq!(rows.len(), 2);
|
||||
for row in rows {
|
||||
let size_bands: String = row.get(0);
|
||||
let score_weights: String = row.get(1);
|
||||
|
||||
// §5.5: floor, target and the penalty above target, per resolution.
|
||||
assert!(size_bands.contains("floor_gib"), "{size_bands}");
|
||||
assert!(size_bands.contains("target_gib"), "{size_bands}");
|
||||
assert!(
|
||||
size_bands.contains("penalty_points_per_gib_over"),
|
||||
"{size_bands}"
|
||||
);
|
||||
// §5.5: the weights that keep source tier and seeders small
|
||||
// against the size term are tuned by hand too.
|
||||
assert!(score_weights.contains("size_at_target"), "{score_weights}");
|
||||
assert!(score_weights.contains("source_tier"), "{score_weights}");
|
||||
assert!(score_weights.contains("seeder_doubling"), "{score_weights}");
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn foreign_keys_are_enforced() {
|
||||
let (_dir, db) = fresh().await;
|
||||
|
||||
Reference in New Issue
Block a user