Define cellular owner diagnostics v9
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 32s
Foundation / checks (network) (push) Failing after 3m1s
Foundation / checks (client) (push) Failing after 4m26s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 32s
Foundation / checks (network) (push) Failing after 3m1s
Foundation / checks (client) (push) Failing after 4m26s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
This commit is contained in:
@@ -83,9 +83,9 @@ void v7_reliable_action_is_stable_and_strict() {
|
||||
CHECK(canonical.size() == cellular_action_input_bytes);
|
||||
CHECK(decode_cellular_action_input(canonical) == input);
|
||||
const CellularAction retry{99, 101, 29, 31, -707, 707, true, 4'000, 5'000};
|
||||
CHECK(encode_cellular_action_input(
|
||||
{retry.tick, retry.move_x, retry.move_y, retry.has_intake_target,
|
||||
retry.intake_x_um, retry.intake_y_um}) == canonical);
|
||||
CHECK(encode_cellular_action_input({retry.tick, retry.move_x, retry.move_y,
|
||||
retry.has_intake_target, retry.intake_x_um,
|
||||
retry.intake_y_um}) == canonical);
|
||||
|
||||
const auto outcome = ActionOutcome{29, ActionResult::committed, 31, 41};
|
||||
const auto outcome_bytes = encode_session(SessionMessage{outcome}, session_protocol_v7);
|
||||
@@ -135,18 +135,50 @@ void v8_perception_is_bounded_and_canonical() {
|
||||
auto duplicate = perception;
|
||||
duplicate.patches[1] = duplicate.patches[0];
|
||||
CHECK(encode_session(SessionMessage{duplicate}).empty());
|
||||
CHECK(encode_session(SessionMessage{CellularPerception{19, 0, {perception.patches[0]}}})
|
||||
.empty());
|
||||
CHECK(
|
||||
encode_session(SessionMessage{CellularPerception{19, 0, {perception.patches[0]}}}).empty());
|
||||
const CellularPerception cleared{19, 0, {}};
|
||||
const auto clear_bytes = encode_session(SessionMessage{cleared});
|
||||
CHECK(std::get<CellularPerception>(*decode_session(clear_bytes)) == cleared);
|
||||
auto oversized = perception;
|
||||
oversized.patches.clear();
|
||||
for (std::size_t i = 0; i <= max_cellular_perceived_patches; ++i)
|
||||
oversized.patches.push_back(
|
||||
{static_cast<std::uint32_t>(i), 0, 0, {0, 0, 0, 0}});
|
||||
oversized.patches.push_back({static_cast<std::uint32_t>(i), 0, 0, {0, 0, 0, 0}});
|
||||
CHECK(encode_session(SessionMessage{oversized}).empty());
|
||||
}
|
||||
|
||||
void v9_perception_carries_only_valid_owner_diagnostics() {
|
||||
CellularPerception perception{27, 82, {{2'000, 3'000, 17, {4, 5, 6, 7}}}};
|
||||
perception.diagnostics = CellularLifeDiagnostics{
|
||||
900, {11, 12, 13, 14}, 21, 8, CellularMovementResult::moved, CellularIntakeResult::acquired,
|
||||
true};
|
||||
const auto bytes = encode_session(SessionMessage{perception});
|
||||
CHECK(!bytes.empty() && bytes.size() == session_header_bytes + 82 + 48);
|
||||
std::uint16_t version{};
|
||||
const auto decoded = decode_session(bytes, &version);
|
||||
CHECK(decoded && version == session_protocol_v9);
|
||||
CHECK(std::get<CellularPerception>(*decoded) == perception);
|
||||
CHECK(encode_session(*decoded) == bytes);
|
||||
|
||||
auto malformed = bytes;
|
||||
malformed[session_header_bytes + 77] = 1; // Reserved byte.
|
||||
CHECK(!decode_session(malformed));
|
||||
malformed = bytes;
|
||||
malformed[session_header_bytes + 74] = 0xFF; // Unknown movement result.
|
||||
CHECK(!decode_session(malformed));
|
||||
malformed = bytes;
|
||||
malformed[session_header_bytes + 76] = 0; // Costs/status require a tick result.
|
||||
CHECK(!decode_session(malformed));
|
||||
|
||||
auto missing = perception;
|
||||
missing.diagnostics.reset();
|
||||
CHECK(encode_session(SessionMessage{missing}, session_protocol_v9).empty());
|
||||
CHECK(encode_session(SessionMessage{perception}, session_protocol_v8).empty());
|
||||
auto cleared = CellularPerception{27, 0, {}};
|
||||
const auto clear_bytes = encode_session(SessionMessage{cleared}, session_protocol_v9);
|
||||
CHECK(!clear_bytes.empty());
|
||||
CHECK(std::get<CellularPerception>(*decode_session(clear_bytes)) == cleared);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
@@ -155,7 +187,8 @@ int main() {
|
||||
malformed_frames_are_refused();
|
||||
v7_reliable_action_is_stable_and_strict();
|
||||
v8_perception_is_bounded_and_canonical();
|
||||
std::puts("PASS cellular protocol: v6 intention, v7 action, v8 perception framing");
|
||||
v9_perception_carries_only_valid_owner_diagnostics();
|
||||
std::puts("PASS cellular protocol: v6 intention, v7 action, v8/v9 perception framing");
|
||||
} catch (const std::exception& error) {
|
||||
std::fprintf(stderr, "%s\n", error.what());
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user