Reference implementation of BB.Bridge for testing.
Records all calls for test assertions and provides controllable responses.
Usage
# Start robot with bridge
start_supervised!(RobotWithBridge)
bridge_pid = BB.Process.whereis(RobotWithBridge, :test_bridge)
# Register to receive change notifications
BB.Test.ParameterBridge.register_test_process(bridge_pid, self())
# Simulate inbound requests from remote
{:ok, params} = BB.Test.ParameterBridge.list_params(bridge_pid)
{:ok, value} = BB.Test.ParameterBridge.get_param(bridge_pid, [:speed])
:ok = BB.Test.ParameterBridge.set_param(bridge_pid, [:speed], 2.0)
# Receive outbound change notifications
assert_receive {:bridge_change, %BB.Parameter.Changed{}}
Summary
Functions
Returns a specification to start this module under a supervisor.
Clear recorded calls.
Get all recorded calls.
Get a parameter value (simulates inbound request from remote).
List all parameters (simulates inbound request from remote).
Register a test process to receive change notifications.
Set a parameter value (simulates inbound request from remote).
Set up fake remote parameters for testing inbound remote access.
Simulate a remote parameter change (for testing subscriptions).
Types
@type t() :: %BB.Test.ParameterBridge{ calls: [{atom(), list()}], remote_params: %{required(BB.Bridge.param_id()) => term()}, robot: module(), subscriptions: MapSet.t(BB.Bridge.param_id()), test_pid: pid() | nil }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Clear recorded calls.
Get all recorded calls.
Get a parameter value (simulates inbound request from remote).
List all parameters (simulates inbound request from remote).
Register a test process to receive change notifications.
Set a parameter value (simulates inbound request from remote).
Set up fake remote parameters for testing inbound remote access.
Simulate a remote parameter change (for testing subscriptions).