Skip to content

Commit

Permalink
tests: add test for 1t pulse gen using comparator
Browse files Browse the repository at this point in the history
  • Loading branch information
StackDoubleFlow committed Jan 19, 2025
1 parent c7b0960 commit 45d80d2
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions tests/timings.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod common;
use common::*;

use mchprs_blocks::{blocks::ComparatorMode, BlockDirection};
use mchprs_blocks::blocks::{Block, ComparatorMode};
use mchprs_blocks::BlockDirection;

test_all_backends!(repeater_t_flip_flop);
fn repeater_t_flip_flop(backend: TestBackend) {
Expand Down Expand Up @@ -75,4 +76,33 @@ fn pulse_gen_2t(backend: TestBackend) {
}

test_all_backends!(pulse_gen_1t);
fn pulse_gen_1t(backend: TestBackend) {}
fn pulse_gen_1t(backend: TestBackend) {
let output_pos = pos(5, 1, 1);
let lever_pos = pos(0, 1, 1);

let mut world = TestWorld::new(1);

make_wire(&mut world, pos(1, 1, 0));
make_repeater(&mut world, pos(2, 1, 0), 2, BlockDirection::West);
make_wire(&mut world, pos(3, 1, 0));
make_wire(&mut world, pos(4, 1, 0));

make_lever(&mut world, lever_pos);
make_wire(&mut world, pos(1, 1, 1));
make_wire(&mut world, pos(2, 1, 1));
make_comparator(
&mut world,
pos(3, 1, 1),
ComparatorMode::Subtract,
BlockDirection::West,
);
place_on_block(&mut world, pos(4, 1, 1), Block::Sandstone {});
place_on_block(&mut world, output_pos, trapdoor());

let mut runner = BackendRunner::new(world, backend);

runner.use_block(lever_pos);
runner.check_powered_for(output_pos, false, 1);
runner.check_powered_for(output_pos, true, 1);
runner.check_powered_for(output_pos, false, 10);
}

0 comments on commit 45d80d2

Please sign in to comment.