Add an iterator style mechanism for iterating through report IDs

This commit is contained in:
Ciaran Woodward
2021-12-20 17:24:27 +00:00
parent da114a1dea
commit 6400e146d0
5 changed files with 54 additions and 3 deletions

View File

@@ -63,6 +63,22 @@ void test_reportid_in_use( void ) {
TEST_ASSERT_EQUAL_UINT( 1, reportIdInUse );
}
void test_get_next_valid_report_id( void ) {
unsigned reportId = 0U;
reportId = hidGetNextValidReportId(reportId);
TEST_ASSERT_EQUAL_UINT( 1, reportIdInUse );
reportId = hidGetNextValidReportId(reportId);
TEST_ASSERT_EQUAL_UINT( 2, reportIdInUse );
reportId = hidGetNextValidReportId(reportId);
TEST_ASSERT_EQUAL_UINT( 3, reportIdInUse );
reportId = hidGetNextValidReportId(reportId);
TEST_ASSERT_EQUAL_UINT( 1, reportIdInUse );
}
// Basic report descriptor tests
void test_unprepared_hidGetReportDescriptor( void )
{

View File

@@ -50,6 +50,16 @@ void test_reportid_in_use( void ) {
TEST_ASSERT_EQUAL_UINT( 0, reportIdInUse );
}
void test_get_next_valid_report_id( void ) {
unsigned reportId = 0U;
reportId = hidGetNextValidReportId(reportId);
TEST_ASSERT_EQUAL_UINT( 0, reportIdInUse );
reportId = hidGetNextValidReportId(reportId);
TEST_ASSERT_EQUAL_UINT( 0, reportIdInUse );
}
// Basic report descriptor tests
void test_unprepared_hidGetReportDescriptor( void )
{