mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 14:12:05 +00:00
Update tests
This commit is contained in:
parent
02fc84a609
commit
d430e765a7
@ -708,42 +708,33 @@ void test_reportToMapDefaultImprecise(void)
|
||||
TEST_ASSERT_EQUAL(1, pubsub->published_.size());
|
||||
const auto &[topic, payload] = pubsub->published_.front();
|
||||
TEST_ASSERT_EQUAL_STRING("msh/2/map/", topic.c_str());
|
||||
verifyLatLong(std::get<DecodedServiceEnvelope>(payload), 70123520, 30015488);
|
||||
}
|
||||
|
||||
// Precise location is reported when configured.
|
||||
void test_reportToMapPrecise(void)
|
||||
{
|
||||
unitTest->reportToMap(/*precision=*/32);
|
||||
|
||||
TEST_ASSERT_EQUAL(1, pubsub->published_.size());
|
||||
const auto &[topic, payload] = pubsub->published_.front();
|
||||
TEST_ASSERT_EQUAL_STRING("msh/2/map/", topic.c_str());
|
||||
verifyLatLong(std::get<DecodedServiceEnvelope>(payload), localPosition.latitude_i, localPosition.longitude_i);
|
||||
}
|
||||
|
||||
// Location is sent over the phone proxy.
|
||||
void test_reportToMapPreciseProxied(void)
|
||||
void test_reportToMapImpreciseProxied(void)
|
||||
{
|
||||
moduleConfig.mqtt.proxy_to_client_enabled = true;
|
||||
MQTTUnitTest::restart();
|
||||
|
||||
unitTest->reportToMap(/*precision=*/32);
|
||||
unitTest->reportToMap(/*precision=*/14);
|
||||
|
||||
TEST_ASSERT_EQUAL(1, mockMeshService->messages_.size());
|
||||
const meshtastic_MqttClientProxyMessage &message = mockMeshService->messages_.front();
|
||||
TEST_ASSERT_EQUAL_STRING("msh/2/map/", message.topic);
|
||||
TEST_ASSERT_EQUAL(meshtastic_MqttClientProxyMessage_data_tag, message.which_payload_variant);
|
||||
const DecodedServiceEnvelope env(message.payload_variant.data.bytes, message.payload_variant.data.size);
|
||||
verifyLatLong(env, localPosition.latitude_i, localPosition.longitude_i);
|
||||
}
|
||||
|
||||
// No location is reported when the precision is invalid.
|
||||
// Imprecise location is reported when the precision is invalid.
|
||||
void test_reportToMapInvalidPrecision(void)
|
||||
{
|
||||
unitTest->reportToMap(/*precision=*/0);
|
||||
|
||||
TEST_ASSERT_TRUE(pubsub->published_.empty());
|
||||
TEST_ASSERT_EQUAL(1, mockMeshService->messages_.size());
|
||||
const meshtastic_MqttClientProxyMessage &message = mockMeshService->messages_.front();
|
||||
TEST_ASSERT_EQUAL_STRING("msh/2/map/", message.topic);
|
||||
TEST_ASSERT_EQUAL(meshtastic_MqttClientProxyMessage_data_tag, message.which_payload_variant);
|
||||
const DecodedServiceEnvelope env(message.payload_variant.data.bytes, message.payload_variant.data.size);
|
||||
}
|
||||
|
||||
// isUsingDefaultServer returns true when using the default server.
|
||||
|
Loading…
Reference in New Issue
Block a user