More granular test

This commit is contained in:
crumblingstatue 2023-04-14 17:57:27 +02:00
parent a9df8af4cf
commit 363d332c0d

View file

@ -359,34 +359,22 @@ const _: () = assert!(
"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..400 {
for x in 0..400 {
w.tile_at_mut(TilePos { x, y }, &wg).mid = 1;
}
}
w.save_chunks();
}
#[test]
fn test_chunk_seri() {
env_logger::builder()
.filter_level(log::LevelFilter::Info)
.init();
let result = std::fs::remove_file("0.0.rgn");
log::info!("File del result: {result:?}");
let mut chk = Chunk {
tiles: default_chunk_tiles(),
};
for t in &mut chk.tiles {
t.bg = 1;
t.fg = 2;
t.mid = 3;
t.bg = 1;
t.fg = 1;
}
for x in 0..5 {
save_chunk(&ChunkPos { x, y: 0 }, &chk);
}
save_chunk(&ChunkPos { x: 0, y: 0 }, &chk);
}