Skip to content

Instantly share code, notes, and snippets.

@hovsep
Created February 23, 2026 20:14
Show Gist options
  • Select an option

  • Save hovsep/1cdcecf18ae10851ac019533407e2cc9 to your computer and use it in GitHub Desktop.

Select an option

Save hovsep/1cdcecf18ae10851ac019533407e2cc9 to your computer and use it in GitHub Desktop.
testing_helper
// WithRunningSimulation is a helper function that runs the simulation and executes a callback after a given duration
func WithRunningSimulation(sim *step_sim.Simulation, duration time.Duration, f func()) {
go sim.Run()
defer func() {
sim.SendCommand(step_sim.Exit)
}()
// Let the simulation run for a while
time.Sleep(duration)
f()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment