anchor.diff:      meck:expect( lurch_driver_port, start,
                    fun( _Driver, _Parameters ) -> { ok, pid_mock } end ),
       meck:expect( lurch_driver_port, stop,
  -                 fun( Port ) -> ok end ),
  +                 fun( _Port ) -> ok end ),
       Pid.
   
   
  
positive.code: 
  -record( state,
      { devices :: orddict:orddict()
      } ).
  
  
  init( _Args ) ->
      Devices = orddict:new(),
      State = #state{ devices = Devices },
      { ok, State }.
  
  
  
negative.code:     ].
  
  
  test_poll_device_event() ->
      meck:new( lurch_driver_port, [] ),
      Token = make_ref(),
      meck:expect( lurch_driver_port, request_event_async,
                   fun( _, _ ) -> Token end ),
      DeviceId = make_ref(),
      Event = myevent,
      Device = #device{ id = DeviceId, events = [ Event ] },
      S0 = #state{ devices = orddict:store( DeviceId, Device, orddict:new() )
                 , polls = [] },
  
      { noreply, S1 } = handle_cast( { poll_device_event, DeviceId, Event }, S0 ),
      { noreply, S2 } = handle_cast( { poll_device_event, invalid, Event }, S0 ),
      { noreply, S3 } = handle_cast( { poll_device_event, DeviceId, invalid }, S0 ),
  
      [ { "valid device and event", ?_assertEqual( [ Token ], S1#state.polls ) }
      , { "invalid device", ?_assertEqual( S0, S2 ) }
      , { "invalid event", ?_assertEqual( S0, S3 ) }
      ].
  
  
  % Helper functions
  dummy_driver_config( ) ->
      [ { driver, ?DRIVER_NAME }
      , { parameters, [] }
  