(&self)
| 610 | |
| 611 | impl Tester { |
| 612 | fn build_machine(&self) -> Machine { |
| 613 | // Default to the no-op pins that always return errors. GPIO unit tests use MockPins |
| 614 | // directly via `make_mock_machine` to validate operation; this Tester wiring is only used |
| 615 | // for the error-path tests that go through the real (NoopPins) backend. |
| 616 | let gpio_pins = Rc::from(RefCell::from(gpio::NoopPins::default())); |
| 617 | let mut builder = MachineBuilder::default() |
| 618 | .with_console(self.console.clone()) |
| 619 | .with_datetime(self.datetime.clone()) |
| 620 | .with_globals(self.global_defs.clone()) |
| 621 | .with_gpio_pins(gpio_pins) |
| 622 | .with_signals_chan((self.signals_tx.clone(), self.signals_rx.clone())); |
| 623 | |
| 624 | for callable in self.callables.clone() { |
| 625 | builder.add_callable(callable); |
| 626 | } |
| 627 | |
| 628 | if self.interactive { |
| 629 | builder |
| 630 | .make_interactive() |
| 631 | .with_program(self.program.clone()) |
| 632 | .with_storage(self.storage.clone()) |
| 633 | .build() |
| 634 | } else { |
| 635 | builder.build() |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | /// Creates a new tester with an empty `Machine`. |
| 640 | pub fn empty() -> Self { |
no test coverage detected