Skip to content

Commit

Permalink
Fix fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
leobeg committed Jan 7, 2025
1 parent 5f7895c commit 4a70a01
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions pumpkin-world/src/chunk/anvil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,16 +470,16 @@ impl AnvilChunkFormat {

#[cfg(test)]
mod tests {
use pumpkin_core::math::vector2::Vector2;
use std::fs;
use std::path::PathBuf;
use pumpkin_core::math::vector2::Vector2;

use crate::chunk::ChunkWriter;
use crate::generation::{get_world_gen, Seed};
use crate::{
chunk::{anvil::AnvilChunkFormat, ChunkReader, ChunkReadingError},
level::LevelFolder,
};
use crate::chunk::ChunkWriter;
use crate::generation::{get_world_gen, Seed};

#[test]
fn not_existing() {
Expand Down Expand Up @@ -519,17 +519,29 @@ mod tests {
for i in 0..5 {
println!("Iteration {}", i + 1);
for (at, chunk) in &chunks {
AnvilChunkFormat.write_chunk(chunk, &level_folder, at).expect("Failed to write chunk");
AnvilChunkFormat
.write_chunk(chunk, &level_folder, at)
.expect("Failed to write chunk");
}

let mut read_chunks = vec![];
for (at, _chunk) in &chunks {
read_chunks.push(AnvilChunkFormat.read_chunk(&level_folder, at).expect("Could not read chunk"));
read_chunks.push(
AnvilChunkFormat
.read_chunk(&level_folder, at)
.expect("Could not read chunk"),
);
}

for (at, chunk) in &chunks {
let read_chunk = read_chunks.iter().find(|chunk| chunk.position == *at).expect("Missing chunk");
assert_eq!(chunk.blocks.blocks, read_chunk.blocks.blocks, "Chunks don't match");
let read_chunk = read_chunks
.iter()
.find(|chunk| chunk.position == *at)
.expect("Missing chunk");
assert_eq!(
chunk.blocks.blocks, read_chunk.blocks.blocks,
"Chunks don't match"
);
}
}

Expand Down

0 comments on commit 4a70a01

Please sign in to comment.