Skip to content

Commit dbd689a

Browse files
committed
Fix issues reported by clang-tidy
1 parent 683ca41 commit dbd689a

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

src/app/tests/TestReadInteraction.cpp

+26-22
Original file line numberDiff line numberDiff line change
@@ -2611,10 +2611,10 @@ void TestReadInteraction::TestSubscribeWildcard()
26112611
ReadPrepareParams readPrepareParams(GetSessionBobToAlice());
26122612
readPrepareParams.mEventPathParamsListSize = 0;
26132613

2614-
std::unique_ptr<chip::app::AttributePathParams[]> attributePathParams(new chip::app::AttributePathParams[2]);
2615-
// Subscribe to full wildcard paths, repeat twice to ensure chunking.
2616-
readPrepareParams.mpAttributePathParamsList = attributePathParams.get();
26172614
readPrepareParams.mAttributePathParamsListSize = 2;
2615+
auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize);
2616+
// Subscribe to full wildcard paths, repeat twice to ensure chunking.
2617+
readPrepareParams.mpAttributePathParamsList = attributePathParams.get();
26182618

26192619
readPrepareParams.mMinIntervalFloorSeconds = 0;
26202620
readPrepareParams.mMaxIntervalCeilingSeconds = 1;
@@ -2745,11 +2745,11 @@ void TestReadInteraction::TestSubscribePartialOverlap()
27452745
ReadPrepareParams readPrepareParams(GetSessionBobToAlice());
27462746
readPrepareParams.mEventPathParamsListSize = 0;
27472747

2748-
std::unique_ptr<chip::app::AttributePathParams[]> attributePathParams(new chip::app::AttributePathParams[2]);
2749-
attributePathParams[0].mClusterId = chip::Test::MockClusterId(3);
2750-
attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(1);
2751-
readPrepareParams.mpAttributePathParamsList = attributePathParams.get();
27522748
readPrepareParams.mAttributePathParamsListSize = 1;
2749+
auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize);
2750+
attributePathParams[0].mClusterId = chip::Test::MockClusterId(3);
2751+
attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(1);
2752+
readPrepareParams.mpAttributePathParamsList = attributePathParams.get();
27532753

27542754
readPrepareParams.mMinIntervalFloorSeconds = 0;
27552755
readPrepareParams.mMaxIntervalCeilingSeconds = 1;
@@ -2817,12 +2817,12 @@ void TestReadInteraction::TestSubscribeSetDirtyFullyOverlap()
28172817
ReadPrepareParams readPrepareParams(GetSessionBobToAlice());
28182818
readPrepareParams.mEventPathParamsListSize = 0;
28192819

2820-
std::unique_ptr<chip::app::AttributePathParams[]> attributePathParams(new chip::app::AttributePathParams[1]);
2821-
attributePathParams[0].mClusterId = chip::Test::kMockEndpoint2;
2822-
attributePathParams[0].mClusterId = chip::Test::MockClusterId(3);
2823-
attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(1);
2824-
readPrepareParams.mpAttributePathParamsList = attributePathParams.get();
28252820
readPrepareParams.mAttributePathParamsListSize = 1;
2821+
auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize);
2822+
attributePathParams[0].mEndpointId = chip::Test::kMockEndpoint2;
2823+
attributePathParams[0].mClusterId = chip::Test::MockClusterId(3);
2824+
attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(1);
2825+
readPrepareParams.mpAttributePathParamsList = attributePathParams.get();
28262826

28272827
readPrepareParams.mMinIntervalFloorSeconds = 0;
28282828
readPrepareParams.mMaxIntervalCeilingSeconds = 1;
@@ -4799,12 +4799,13 @@ void TestReadInteraction::TestSubscribeInvalidateFabric()
47994799
EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR);
48004800

48014801
ReadPrepareParams readPrepareParams(GetSessionBobToAlice());
4802-
readPrepareParams.mpAttributePathParamsList = new chip::app::AttributePathParams[1];
4803-
readPrepareParams.mAttributePathParamsListSize = 1;
48044802

4805-
readPrepareParams.mpAttributePathParamsList[0].mEndpointId = chip::Test::kMockEndpoint3;
4806-
readPrepareParams.mpAttributePathParamsList[0].mClusterId = chip::Test::MockClusterId(2);
4807-
readPrepareParams.mpAttributePathParamsList[0].mAttributeId = chip::Test::MockAttributeId(1);
4803+
readPrepareParams.mAttributePathParamsListSize = 1;
4804+
auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize);
4805+
attributePathParams[0].mEndpointId = chip::Test::kMockEndpoint3;
4806+
attributePathParams[0].mClusterId = chip::Test::MockClusterId(2);
4807+
attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(1);
4808+
readPrepareParams.mpAttributePathParamsList = attributePathParams.get();
48084809

48094810
readPrepareParams.mMinIntervalFloorSeconds = 0;
48104811
readPrepareParams.mMaxIntervalCeilingSeconds = 0;
@@ -4815,6 +4816,7 @@ void TestReadInteraction::TestSubscribeInvalidateFabric()
48154816

48164817
delegate.mGotReport = false;
48174818

4819+
attributePathParams.release();
48184820
EXPECT_EQ(readClient.SendAutoResubscribeRequest(std::move(readPrepareParams)), CHIP_NO_ERROR);
48194821

48204822
DrainAndServiceIO();
@@ -4856,12 +4858,13 @@ void TestReadInteraction::TestShutdownSubscription()
48564858
EXPECT_EQ(engine->Init(&GetExchangeManager(), &GetFabricTable(), gReportScheduler), CHIP_NO_ERROR);
48574859

48584860
ReadPrepareParams readPrepareParams(GetSessionBobToAlice());
4859-
readPrepareParams.mpAttributePathParamsList = new chip::app::AttributePathParams[1];
4860-
readPrepareParams.mAttributePathParamsListSize = 1;
48614861

4862-
readPrepareParams.mpAttributePathParamsList[0].mEndpointId = chip::Test::kMockEndpoint3;
4863-
readPrepareParams.mpAttributePathParamsList[0].mClusterId = chip::Test::MockClusterId(2);
4864-
readPrepareParams.mpAttributePathParamsList[0].mAttributeId = chip::Test::MockAttributeId(1);
4862+
readPrepareParams.mAttributePathParamsListSize = 1;
4863+
auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize);
4864+
attributePathParams[0].mEndpointId = chip::Test::kMockEndpoint3;
4865+
attributePathParams[0].mClusterId = chip::Test::MockClusterId(2);
4866+
attributePathParams[0].mAttributeId = chip::Test::MockAttributeId(1);
4867+
readPrepareParams.mpAttributePathParamsList = attributePathParams.get();
48654868

48664869
readPrepareParams.mMinIntervalFloorSeconds = 0;
48674870
readPrepareParams.mMaxIntervalCeilingSeconds = 0;
@@ -4872,6 +4875,7 @@ void TestReadInteraction::TestShutdownSubscription()
48724875

48734876
delegate.mGotReport = false;
48744877

4878+
attributePathParams.release();
48754879
EXPECT_EQ(readClient.SendAutoResubscribeRequest(std::move(readPrepareParams)), CHIP_NO_ERROR);
48764880

48774881
DrainAndServiceIO();

0 commit comments

Comments
 (0)