test: use nextest and shorten weekly survival test
Co-Authored-By: GitHub Copilot <noreply@github.com>
This commit is contained in:
parent
db23f87450
commit
e5dc752b41
4
Justfile
4
Justfile
|
|
@ -10,5 +10,9 @@ stop:
|
||||||
admin:
|
admin:
|
||||||
docker compose exec -T app cat /data/admin-password
|
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:
|
dev:
|
||||||
SHARD_DATABASE_URL="sqlite://sim-shard-{shard}.db?mode=rwc" cargo run
|
SHARD_DATABASE_URL="sqlite://sim-shard-{shard}.db?mode=rwc" cargo run
|
||||||
11
src/world.rs
11
src/world.rs
|
|
@ -3736,7 +3736,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The default script at the size of the original single village, for long-running 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 = [
|
let source = [
|
||||||
("WIDTH", "96"),
|
("WIDTH", "96"),
|
||||||
("HEIGHT", "64"),
|
("HEIGHT", "64"),
|
||||||
|
|
@ -3757,6 +3757,11 @@ mod tests {
|
||||||
.fold(DEFAULT_SCRIPT.to_string(), |source, (name, value)| {
|
.fold(DEFAULT_SCRIPT.to_string(), |source, (name, value)| {
|
||||||
with_constant(&source, name, value)
|
with_constant(&source, name, value)
|
||||||
});
|
});
|
||||||
|
source
|
||||||
|
}
|
||||||
|
|
||||||
|
fn village_script() -> SimScript {
|
||||||
|
let source = village_script_source();
|
||||||
SimScript::load(&source).unwrap()
|
SimScript::load(&source).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4326,7 +4331,9 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn village_survives_until_its_first_weekly_birth_check() {
|
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 =
|
let first_week_tick =
|
||||||
world.calendar.ticks_per_day * u64::from(world.calendar.days_per_week);
|
world.calendar.ticks_per_day * u64::from(world.calendar.days_per_week);
|
||||||
let mut daily = Vec::new();
|
let mut daily = Vec::new();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue