Skip to content

Fix/update and add unit tests#346

Merged
AniruddhaKanhere merged 1 commit intoFreeRTOS:MQTTv5-reviewed-changesfrom
AniruddhaKanhere:FixUnitTests
Jan 17, 2026
Merged

Fix/update and add unit tests#346
AniruddhaKanhere merged 1 commit intoFreeRTOS:MQTTv5-reviewed-changesfrom
AniruddhaKanhere:FixUnitTests

Conversation

@AniruddhaKanhere
Copy link
Member

Description

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@AniruddhaKanhere AniruddhaKanhere force-pushed the FixUnitTests branch 12 times, most recently from e9aaa73 to 37e3b02 Compare January 15, 2026 01:20
@AniruddhaKanhere AniruddhaKanhere force-pushed the FixUnitTests branch 3 times, most recently from 178edf9 to f3ddfd4 Compare January 16, 2026 08:11
@kstribrnAmzn
Copy link
Member

Coverage metrics per our chat:

 Summary coverage rate:
    lines......: 98.3% (4540 of 4620 lines)
    functions..: 100.0% (209 of 209 functions)
    branches...: 96.6% (2377 of 2461 branches)

Comment on lines +376 to +377
status = MQTTPropAdd_MaxPacketSize( &PropertyBuilder, 0, &OptionalMqttPacketType );
TEST_ASSERT_EQUAL( MQTTBadParameter, status );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: To keep consistent ordering move this to be the first test

Comment on lines +1162 to +1167
PropertyBuilder.pBuffer = buffer;
PropertyBuilder.currentIndex = 0;
PropertyBuilder.bufferLength = 100;
PropertyBuilder.fieldSet = 0;
status = MQTTPropAdd_AuthData( &PropertyBuilder, "Hello", 5, &OptionalMqttPacketType );
TEST_ASSERT_EQUAL( MQTTBadParameter, status );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for consistent ordering move this before the previous test

Comment on lines +1480 to +1485
status = MQTTPropAdd_ResponseTopic( NULL, "hello", 5, &OptionalMqttPacketType );
TEST_ASSERT_EQUAL( MQTTBadParameter, status );

PropertyBuilder.pBuffer = NULL;
status = MQTTPropAdd_ResponseTopic( &PropertyBuilder, "hello", 5, &OptionalMqttPacketType );
TEST_ASSERT_EQUAL( MQTTBadParameter, status );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is checked in addPropUtf8. Move this below the next two tests which are defined directly in MQTTPropAdd_ResponseTopic.

@AniruddhaKanhere AniruddhaKanhere force-pushed the FixUnitTests branch 2 times, most recently from 41e437a to ced71e4 Compare January 17, 2026 00:06
@AniruddhaKanhere
Copy link
Member Author

Updated coverage rate:

Overall coverage rate:
  lines......: 99.5% (4607 of 4629 lines)
  functions......: 100.0% (209 of 209 functions)
  branches......: 98.1% (2418 of 2465 branches)

@AniruddhaKanhere AniruddhaKanhere merged commit 6da5853 into FreeRTOS:MQTTv5-reviewed-changes Jan 17, 2026
8 of 11 checks passed
@AniruddhaKanhere AniruddhaKanhere deleted the FixUnitTests branch February 6, 2026 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants