MockTelemetryBackend
Keeps everything it is given, for tests that want to check what robot code logged.
val clock = TestTimeSource()
val registry = TelemetryRegistry(clock)
val mock = MockTelemetryBackend().also(registry::register)
registry.table("Drive").log("left", 1.5)
assertEquals(listOf(1.5), mock.valuesAt("/Drive/left"))Content copied to clipboard
Arrays and lists are copied when they are logged, so changing one afterwards doesn't change what the backend recorded. A struct is recorded as the object that was logged, so tests can compare it with ==. It is safe to log from several threads. The inspection methods return copies, which can be stale if logging is still running.
Types
Functions
Link copied to clipboard
open override fun entry(path: String, type: TelemetryType, properties: Map<String, Any> = emptyMap()): TelemetryEntry
Returns the entry for path, creating it if this backend hasn't seen the path.
Link copied to clipboard
Link copied to clipboard
The timestamps of the values logged to path, oldest first, in microseconds.
Link copied to clipboard
The type path was created with, or null if nothing has created it.