Skip to content

Commit

Permalink
tests: include backend information when assert fails
Browse files Browse the repository at this point in the history
  • Loading branch information
StackDoubleFlow committed Sep 17, 2024
1 parent ab76784 commit 6e2d211
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,11 @@ impl World for TestWorld {
}

struct RedpilerInstance {
variant: BackendVariant,
options: CompilerOptions,
world: TestWorld,
compiler: Compiler,
}

impl RedpilerInstance {
fn tick(&mut self) {
self.compiler.tick();
self.compiler.flush(&mut self.world);
}
}

pub struct AllBackendRunner {
redstone_world: TestWorld,
redpilers: Vec<RedpilerInstance>,
Expand All @@ -158,7 +150,6 @@ impl AllBackendRunner {
let ticks = world.to_be_ticked.clone();
compiler.compile(&world, bounds, options.clone(), ticks, monitor);
RedpilerInstance {
variant,
options,
world: world.clone(),
compiler,
Expand Down Expand Up @@ -214,12 +205,15 @@ impl AllBackendRunner {
pub fn check_block_powered(&self, pos: BlockPos, powered: bool) {
assert_eq!(
is_block_powered(self.redstone_world.get_block(pos)),
Some(powered)
Some(powered),
"when testing with the base redstone implementation"
);
for redpiler in &self.redpilers {
assert_eq!(
is_block_powered(redpiler.world.get_block(pos)),
Some(powered)
Some(powered),
"when testing on redpiler options: {:#?}",
redpiler.options
);
}
}
Expand Down

0 comments on commit 6e2d211

Please sign in to comment.