mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-14 19:55:02 +01:00
More granular test
This commit is contained in:
parent
a9df8af4cf
commit
363d332c0d
1 changed files with 7 additions and 19 deletions
26
src/world.rs
26
src/world.rs
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue