mirror of
https://github.com/FreeRTOS/coreMQTT
synced 2025-06-06 03:40:21 +08:00
Fix MQTT_Status_strerror to return correct error on NeedMoreBytes error (#255)
* Fix timeout calculation to account for overflow * Add unit tests to check for overflow * Update timeout value in UT * Fix formatting * Update core_mqtt_utest.c * Add one more unit test to check for one corner case * Make unit-test more robust * Fix MQTT_Status_strerror to return correct error on NeedMoreBytes error.
This commit is contained in:
parent
0df6f495e7
commit
c5a1efe3ca
@ -3373,6 +3373,10 @@ const char * MQTT_Status_strerror( MQTTStatus_t status )
|
||||
str = "MQTTKeepAliveTimeout";
|
||||
break;
|
||||
|
||||
case MQTTNeedMoreBytes:
|
||||
str = "MQTTNeedMoreBytes";
|
||||
break;
|
||||
|
||||
default:
|
||||
str = "Invalid MQTT Status code";
|
||||
break;
|
||||
|
@ -5842,7 +5842,11 @@ void test_MQTT_Status_strerror( void )
|
||||
str = MQTT_Status_strerror( status );
|
||||
TEST_ASSERT_EQUAL_STRING( "MQTTKeepAliveTimeout", str );
|
||||
|
||||
status = MQTTKeepAliveTimeout + 1;
|
||||
status = MQTTNeedMoreBytes;
|
||||
str = MQTT_Status_strerror( status );
|
||||
TEST_ASSERT_EQUAL_STRING( "MQTTNeedMoreBytes", str );
|
||||
|
||||
status = MQTTNeedMoreBytes + 1;
|
||||
str = MQTT_Status_strerror( status );
|
||||
TEST_ASSERT_EQUAL_STRING( "Invalid MQTT Status code", str );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user