@@ -428,22 +428,18 @@ static void TestChipCert_CertValidation(nlTestSuite * inSuite, void * inContext)
428
428
{ TestCert::kNode01_01 , sGenTBSHashFlag , sNullLoadFlag } } },
429
429
};
430
430
// clang-format on
431
- static const size_t sNumValidationTestCases = ArraySize (sValidationTestCases );
432
431
433
- for (unsigned i = 0 ; i < sNumValidationTestCases ; i++ )
432
+ for (const auto & testCase : sValidationTestCases )
434
433
{
435
434
const ChipCertificateData * resultCert = nullptr ;
436
- const ValidationTestCase & testCase = sValidationTestCases [i];
437
-
438
- err = certSet.Init (kMaxCertsPerTestCase );
435
+ err = certSet.Init (kMaxCertsPerTestCase );
439
436
NL_TEST_ASSERT (inSuite, err == CHIP_NO_ERROR);
440
437
441
- for (size_t i2 = 0 ; i2 < kMaxCertsPerTestCase ; i2++ )
438
+ for (auto inputCert : testCase. InputCerts )
442
439
{
443
- if (testCase. InputCerts [i2] .Type != TestCert::kNone )
440
+ if (inputCert .Type != TestCert::kNone )
444
441
{
445
- err = LoadTestCert (certSet, testCase.InputCerts [i2].Type , testCase.InputCerts [i2].LoadFlags ,
446
- testCase.InputCerts [i2].DecodeFlags );
442
+ err = LoadTestCert (certSet, inputCert.Type , inputCert.LoadFlags , inputCert.DecodeFlags );
447
443
NL_TEST_ASSERT (inSuite, err == CHIP_NO_ERROR);
448
444
}
449
445
}
@@ -1137,11 +1133,8 @@ static void TestChipCert_CertType(nlTestSuite * inSuite, void * inContext)
1137
1133
{ TestCert::kNode02_02 , kCertType_Node },
1138
1134
};
1139
1135
// clang-format on
1140
- static const size_t sNumTestCases = ArraySize (sTestCases );
1141
-
1142
- for (unsigned i = 0 ; i < sNumTestCases ; i++)
1136
+ for (const auto & testCase : sTestCases )
1143
1137
{
1144
- const TestCase & testCase = sTestCases [i];
1145
1138
uint8_t certType;
1146
1139
1147
1140
err = certSet.Init (1 );
@@ -1186,11 +1179,8 @@ static void TestChipCert_CertId(nlTestSuite * inSuite, void * inContext)
1186
1179
{ TestCert::kNode02_02 , 0xDEDEDEDE00020002 },
1187
1180
};
1188
1181
// clang-format on
1189
- static const size_t sNumTestCases = ArraySize (sTestCases );
1190
-
1191
- for (unsigned i = 0 ; i < sNumTestCases ; i++)
1182
+ for (const auto & testCase : sTestCases )
1192
1183
{
1193
- const TestCase & testCase = sTestCases [i];
1194
1184
uint64_t chipId;
1195
1185
1196
1186
err = certSet.Init (certData, 1 );
0 commit comments