|
1 | 1 | mod common; |
2 | 2 | use common::*; |
3 | 3 |
|
4 | | -use mchprs_blocks::{blocks::ComparatorMode, BlockDirection}; |
| 4 | +use mchprs_blocks::blocks::{Block, ComparatorMode}; |
| 5 | +use mchprs_blocks::BlockDirection; |
5 | 6 |
|
6 | 7 | test_all_backends!(repeater_t_flip_flop); |
7 | 8 | fn repeater_t_flip_flop(backend: TestBackend) { |
@@ -75,4 +76,33 @@ fn pulse_gen_2t(backend: TestBackend) { |
75 | 76 | } |
76 | 77 |
|
77 | 78 | test_all_backends!(pulse_gen_1t); |
78 | | -fn pulse_gen_1t(backend: TestBackend) {} |
| 79 | +fn pulse_gen_1t(backend: TestBackend) { |
| 80 | + let output_pos = pos(5, 1, 1); |
| 81 | + let lever_pos = pos(0, 1, 1); |
| 82 | + |
| 83 | + let mut world = TestWorld::new(1); |
| 84 | + |
| 85 | + make_wire(&mut world, pos(1, 1, 0)); |
| 86 | + make_repeater(&mut world, pos(2, 1, 0), 2, BlockDirection::West); |
| 87 | + make_wire(&mut world, pos(3, 1, 0)); |
| 88 | + make_wire(&mut world, pos(4, 1, 0)); |
| 89 | + |
| 90 | + make_lever(&mut world, lever_pos); |
| 91 | + make_wire(&mut world, pos(1, 1, 1)); |
| 92 | + make_wire(&mut world, pos(2, 1, 1)); |
| 93 | + make_comparator( |
| 94 | + &mut world, |
| 95 | + pos(3, 1, 1), |
| 96 | + ComparatorMode::Subtract, |
| 97 | + BlockDirection::West, |
| 98 | + ); |
| 99 | + place_on_block(&mut world, pos(4, 1, 1), Block::Sandstone {}); |
| 100 | + place_on_block(&mut world, output_pos, trapdoor()); |
| 101 | + |
| 102 | + let mut runner = BackendRunner::new(world, backend); |
| 103 | + |
| 104 | + runner.use_block(lever_pos); |
| 105 | + runner.check_powered_for(output_pos, false, 1); |
| 106 | + runner.check_powered_for(output_pos, true, 1); |
| 107 | + runner.check_powered_for(output_pos, false, 10); |
| 108 | +} |
0 commit comments