MCPcopy Create free account
hub / github.com/Blizzard/s2client-api / OnStep

Method OnStep

tests/test_framework.cc:46–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44//
45
46void UnitTestBot::OnStep() {
47 const ObservationInterface* obs = Observation();
48 uint32_t game_loop = obs->GetGameLoop();
49
50 // Move to the next sequence if this sequence is done.
51 if (game_loop >= game_loop_done_) {
52 if (current_sequence_ == std::size_t(-1)) {
53 current_sequence_ = 0;
54 OnTestsBegin();
55 }
56 else {
57 sequences_[current_sequence_]->OnTestFinish();
58 if (!sequences_[current_sequence_]->DidSucceed()) {
59 success_ = false;
60 std::cout << "Test: " << sequences_[current_sequence_]->test_name_ << " failed!" << std::endl;
61 for (const std::string& error : sequences_[current_sequence_]->errors_) {
62 std::cout << " Error: " << error << std::endl;
63 }
64 }
65 ++current_sequence_;
66 }
67 if (IsFinished()) {
68 OnTestsEnd();
69 return;
70 }
71
72 sequences_[current_sequence_]->OnTestStart();
73 game_loop_done_ = game_loop + sequences_[current_sequence_]->wait_game_loops_;
74 return;
75 }
76 if (current_sequence_ == std::size_t(-1))
77 return;
78
79 sequences_[current_sequence_]->OnStep();
80
81 OnPostStep();
82}
83
84void UnitTestBot::OnGameStart() {
85 if (current_sequence_ < sequences_.size()) {

Callers 1

IssueEventsMethod · 0.45

Calls 5

ObservationClass · 0.85
GetGameLoopMethod · 0.80
DidSucceedMethod · 0.80
OnTestFinishMethod · 0.45
OnTestStartMethod · 0.45

Tested by

no test coverage detected