From faa3129c6f7b85cf41dc0c8fe7f50e0c70576288 Mon Sep 17 00:00:00 2001 From: crumblingstatue Date: Fri, 14 Apr 2023 16:32:10 +0200 Subject: [PATCH] Create world serialization test that reproduces zstd frame issue --- src/world.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/world.rs b/src/world.rs index 0e61a45..5cfb420 100644 --- a/src/world.rs +++ b/src/world.rs @@ -357,3 +357,19 @@ const _: () = assert!( REGION_N_CHUNKS <= 64, "A region file uses an existence bitset that's a 64 bit integer" ); + +/// Test that world serialization doesn't panic +#[test] +fn test_world_serialization() { + env_logger::builder() + .filter_level(log::LevelFilter::Info) + .init(); + let mut w = World::new(WorldPos { x: 0, y: 0 }, "smoltestworld"); + let wg = Worldgen::from_seed(0); + for y in 0..900 { + for x in 0..900 { + w.tile_at_mut(TilePos { x, y }, &wg).mid = (x + y) as u16; + } + } + w.save(); +}