2026-10-27 (3VO): Unit Testing, Project Kickoff#

Unit Testing#

Project Talk#

Door#

  • Paradigm: polling

    Every n time units we look at switch states, and react accordingly. Hypothetical main program will look like follows.

    This is only a goal! We start with unit tests, and there won’t be a main program initially.

    FSM fsm(open_switch, closed_switch, dwim_switch, motor);
    while (true) {
        fsm.check();
        sleep(1ms);
    }
    
  • FSM, as sketched here

    • Constructor, and check() method as envisioned above

    • Hardware independent

    • Defines interfaces, a task not to be taken lightly

      • Input switch

      • Motor

    • First stage: test coverage of all transitions; mock implementations of interfaces as needed by unit tests

  • Input switch (reading state from file)

    • Interface ideally as defined by FSM. We are starting in parallel with FSM, so interfaces not yet stable/available

      ⟶ Meeting with FSM group to setup common viewpoint.

    • First “real” implementation (as opposed to lightweight mock used by FSM team): read switch state from file

  • Motor (writing state to file)

    • Interface ideally as defined by FSM. We are starting in parallel with FSM, so interfaces not yet stable/available

      ⟶ Meeting with FSM group to setup common viewpoint.

    • First “real” implementation (as opposed to lightweight mock used by FSM team): write motor state to file (“idle”, “forward”, “backward”)

  • Integration ⟶ Firmware

    At some point we want to create a fake door firmware where the poor manual tester …

    • writes ones and zeroes into switch files

    • checks the motor file to see if everything is alright