|
|
@ -131,9 +131,9 @@ func TestNewMatch(t *testing.T) {
|
|
|
|
alliance_2 := NewAlliance(team_3, team_4)
|
|
|
|
alliance_2 := NewAlliance(team_3, team_4)
|
|
|
|
|
|
|
|
|
|
|
|
arena := NewVirtualArena(arena_name)
|
|
|
|
arena := NewVirtualArena(arena_name)
|
|
|
|
|
|
|
|
arena_c := arena.UpdateChannel()
|
|
|
|
|
|
|
|
|
|
|
|
match := NewMatch(alliance_1, alliance_2, arena)
|
|
|
|
match := NewMatch(alliance_1, alliance_2, arena)
|
|
|
|
match_c := match.UpdateChannel()
|
|
|
|
|
|
|
|
root_event := NewEventQueue("root_event", "", []Resource{})
|
|
|
|
root_event := NewEventQueue("root_event", "", []Resource{})
|
|
|
|
r := root_event.DoneResource()
|
|
|
|
r := root_event.DoneResource()
|
|
|
|
|
|
|
|
|
|
|
@ -148,34 +148,34 @@ func TestNewMatch(t *testing.T) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
go func(match_c chan GraphSignal) {
|
|
|
|
go func(arena_c chan GraphSignal) {
|
|
|
|
(*graph_tester)(t).WaitForValue(match_c, "event_start", 1*time.Second, "no event_start")
|
|
|
|
(*graph_tester)(t).WaitForValue(arena_c, "event_start", 1*time.Second, "no event_start")
|
|
|
|
(*graph_tester)(t).CheckForNone(match_c, "update to match after starting")
|
|
|
|
(*graph_tester)(t).CheckForNone(arena_c, "update to match after starting")
|
|
|
|
SendUpdate(arena, NewSignal(nil, "queue_autonomous"))
|
|
|
|
SendUpdate(arena, NewSignal(nil, "queue_autonomous"))
|
|
|
|
(*graph_tester)(t).WaitForValue(match_c, "autonomous_queued", 1*time.Second, "no autonomous_queued")
|
|
|
|
(*graph_tester)(t).WaitForValue(arena_c, "autonomous_queued", 1*time.Second, "no autonomous_queued")
|
|
|
|
(*graph_tester)(t).CheckForNone(match_c, "update to match after queueing autonomous")
|
|
|
|
(*graph_tester)(t).CheckForNone(arena_c, "update to match after queueing autonomous")
|
|
|
|
auton_signal := NewSignal(nil, "start_autonomous")
|
|
|
|
auton_signal := NewSignal(nil, "start_autonomous")
|
|
|
|
auton_signal.time = time.Now()
|
|
|
|
auton_signal.time = time.Now()
|
|
|
|
SendUpdate(arena, auton_signal)
|
|
|
|
SendUpdate(arena, auton_signal)
|
|
|
|
(*graph_tester)(t).WaitForValue(match_c, "autonomous_running", 1*time.Second, "no autonomous_running")
|
|
|
|
(*graph_tester)(t).WaitForValue(arena_c, "autonomous_running", 1*time.Second, "no autonomous_running")
|
|
|
|
(*graph_tester)(t).CheckForNone(match_c, "update to match after starting autonomous")
|
|
|
|
(*graph_tester)(t).CheckForNone(arena_c, "update to match after starting autonomous")
|
|
|
|
time.Sleep(TEMP_AUTON_TIME)
|
|
|
|
time.Sleep(TEMP_AUTON_TIME)
|
|
|
|
time.Sleep(time.Millisecond * 100)
|
|
|
|
time.Sleep(time.Millisecond * 100)
|
|
|
|
(*graph_tester)(t).WaitForValue(match_c, "autonomous_done", 6*time.Second, "no autonomous_done")
|
|
|
|
(*graph_tester)(t).WaitForValue(arena_c, "autonomous_done", 6*time.Second, "no autonomous_done")
|
|
|
|
(*graph_tester)(t).CheckForNone(match_c, "update to match after ending autonomous")
|
|
|
|
(*graph_tester)(t).CheckForNone(arena_c, "update to match after ending autonomous")
|
|
|
|
SendUpdate(arena, NewSignal(nil, "queue_driver"))
|
|
|
|
SendUpdate(arena, NewSignal(nil, "queue_driver"))
|
|
|
|
(*graph_tester)(t).WaitForValue(match_c, "driver_queued", 1*time.Second, "no driver_queued")
|
|
|
|
(*graph_tester)(t).WaitForValue(arena_c, "driver_queued", 1*time.Second, "no driver_queued")
|
|
|
|
(*graph_tester)(t).CheckForNone(match_c, "update to match after queueing driver")
|
|
|
|
(*graph_tester)(t).CheckForNone(arena_c, "update to match after queueing driver")
|
|
|
|
driver_signal := NewSignal(nil, "start_driver")
|
|
|
|
driver_signal := NewSignal(nil, "start_driver")
|
|
|
|
driver_signal.time = time.Now()
|
|
|
|
driver_signal.time = time.Now()
|
|
|
|
SendUpdate(arena, driver_signal)
|
|
|
|
SendUpdate(arena, driver_signal)
|
|
|
|
(*graph_tester)(t).WaitForValue(match_c, "driver_running", 1*time.Second, "no driver_running")
|
|
|
|
(*graph_tester)(t).WaitForValue(arena_c, "driver_running", 1*time.Second, "no driver_running")
|
|
|
|
(*graph_tester)(t).CheckForNone(match_c, "update to match after starting driver")
|
|
|
|
(*graph_tester)(t).CheckForNone(arena_c, "update to match after starting driver")
|
|
|
|
time.Sleep(TEMP_DRIVE_TIME)
|
|
|
|
time.Sleep(TEMP_DRIVE_TIME)
|
|
|
|
time.Sleep(time.Millisecond * 100)
|
|
|
|
time.Sleep(time.Millisecond * 100)
|
|
|
|
(*graph_tester)(t).WaitForValue(match_c, "driver_done", 1*time.Second, "no driver_done")
|
|
|
|
(*graph_tester)(t).WaitForValue(arena_c, "driver_done", 1*time.Second, "no driver_done")
|
|
|
|
(*graph_tester)(t).CheckForNone(match_c, "update to match after game done 3")
|
|
|
|
(*graph_tester)(t).CheckForNone(arena_c, "update to match after game done 3")
|
|
|
|
}(match_c)
|
|
|
|
}(arena_c)
|
|
|
|
|
|
|
|
|
|
|
|
err := event_manager.Run()
|
|
|
|
err := event_manager.Run()
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|