Expand integration suite to cover all months of 2026, minor refactorings

This commit is contained in:
2026-02-28 10:01:26 +02:00
parent 934e2c2fd2
commit 3ecdc91802
8 changed files with 118 additions and 84 deletions

View File

@@ -22,10 +22,14 @@ mod integration_tests {
}
#[rstest]
fn test_minimal_config(minimal_config: UserConfig) -> anyhow::Result<()> {
fn test_minimal_config(
#[values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)] month_idx: u8,
mut minimal_config: UserConfig,
) -> anyhow::Result<()> {
minimal_config.update_month(month_idx);
let scheduler = Scheduler::new_with_config(minimal_config.clone());
let mut schedule = MonthlySchedule::new();
let mut tracker = WorkloadTracker::default();
let scheduler = Scheduler::new_with_config(minimal_config.clone());
let solved = scheduler.run(&mut schedule, &mut tracker)?;
println!("{}", schedule.report(&minimal_config, &tracker));
@@ -36,10 +40,14 @@ mod integration_tests {
}
#[rstest]
fn test_maximal_config(maximal_config: UserConfig) -> anyhow::Result<()> {
fn test_maximal_config(
#[values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)] month_idx: u8,
mut maximal_config: UserConfig,
) -> anyhow::Result<()> {
maximal_config.update_month(month_idx);
let scheduler = Scheduler::new_with_config(maximal_config.clone());
let mut schedule = MonthlySchedule::new();
let mut tracker = WorkloadTracker::default();
let scheduler = Scheduler::new_with_config(maximal_config.clone());
let solved = scheduler.run(&mut schedule, &mut tracker)?;
println!("{}", schedule.report(&maximal_config, &tracker));
@@ -51,11 +59,13 @@ mod integration_tests {
#[rstest]
fn test_manual_shifts_heavy_config(
manual_shifts_heavy_config: UserConfig,
#[values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)] month_idx: u8,
mut manual_shifts_heavy_config: UserConfig,
) -> anyhow::Result<()> {
manual_shifts_heavy_config.update_month(month_idx);
let scheduler = Scheduler::new_with_config(manual_shifts_heavy_config.clone());
let mut schedule = MonthlySchedule::new();
let mut tracker = WorkloadTracker::default();
let scheduler = Scheduler::new_with_config(manual_shifts_heavy_config.clone());
let solved = scheduler.run(&mut schedule, &mut tracker)?;
println!("{}", schedule.report(&manual_shifts_heavy_config, &tracker));
@@ -66,10 +76,14 @@ mod integration_tests {
}
#[rstest]
fn test_complex_config(complex_config: UserConfig) -> anyhow::Result<()> {
fn test_complex_config(
#[values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)] month_idx: u8,
mut complex_config: UserConfig,
) -> anyhow::Result<()> {
complex_config.update_month(month_idx);
let scheduler = Scheduler::new_with_config(complex_config.clone());
let mut schedule = MonthlySchedule::new();
let mut tracker = WorkloadTracker::default();
let scheduler = Scheduler::new_with_config(complex_config.clone());
let solved = scheduler.run(&mut schedule, &mut tracker)?;
println!("{}", schedule.report(&complex_config, &tracker));
@@ -80,10 +94,14 @@ mod integration_tests {
}
#[rstest]
fn test_hard_config(hard_config: UserConfig) -> anyhow::Result<()> {
fn test_hard_config(
#[values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)] month_idx: u8,
mut hard_config: UserConfig,
) -> anyhow::Result<()> {
hard_config.update_month(month_idx);
let scheduler = Scheduler::new_with_config(hard_config.clone());
let mut schedule = MonthlySchedule::new();
let mut tracker = WorkloadTracker::default();
let scheduler = Scheduler::new_with_config(hard_config.clone());
let solved = scheduler.run(&mut schedule, &mut tracker)?;
println!("{}", schedule.report(&hard_config, &tracker));
@@ -95,9 +113,9 @@ mod integration_tests {
#[rstest]
fn test_export_pipeline(minimal_config: UserConfig) -> anyhow::Result<()> {
let scheduler = Scheduler::new_with_config(minimal_config.clone());
let mut schedule = MonthlySchedule::new();
let mut tracker = WorkloadTracker::default();
let scheduler = Scheduler::new_with_config(minimal_config.clone());
assert!(scheduler.run(&mut schedule, &mut tracker)?);
schedule.export_as_docx(&minimal_config)?;
@@ -105,6 +123,7 @@ mod integration_tests {
let metadata = std::fs::metadata("rota.docx")?;
assert!(metadata.len() > 0);
std::fs::remove_file("rota.docx")?;
Ok(())
}
}