diff --git a/Justfile b/Justfile index 64db2b8..1c3eb21 100644 --- a/Justfile +++ b/Justfile @@ -10,5 +10,9 @@ stop: admin: docker compose exec -T app cat /data/admin-password +test: + if ! cargo nextest --version >/dev/null 2>&1; then cargo install cargo-nextest --locked; fi + cargo nextest run --workspace + dev: SHARD_DATABASE_URL="sqlite://sim-shard-{shard}.db?mode=rwc" cargo run \ No newline at end of file diff --git a/src/world.rs b/src/world.rs index 1fec924..de0bef8 100644 --- a/src/world.rs +++ b/src/world.rs @@ -3736,7 +3736,7 @@ mod tests { } /// The default script at the size of the original single village, for long-running tests. - fn village_script() -> SimScript { + fn village_script_source() -> String { let source = [ ("WIDTH", "96"), ("HEIGHT", "64"), @@ -3757,6 +3757,11 @@ mod tests { .fold(DEFAULT_SCRIPT.to_string(), |source, (name, value)| { with_constant(&source, name, value) }); + source + } + + fn village_script() -> SimScript { + let source = village_script_source(); SimScript::load(&source).unwrap() } @@ -4326,7 +4331,9 @@ mod tests { #[test] fn village_survives_until_its_first_weekly_birth_check() { - let mut world = World::new_with_script(42, village_script()); + let script = with_constant(&village_script_source(), "TICKS_PER_DAY", "240"); + let script = SimScript::load(&script).unwrap(); + let mut world = World::new_with_script(42, script); let first_week_tick = world.calendar.ticks_per_day * u64::from(world.calendar.days_per_week); let mut daily = Vec::new();