Skip to content

Commit

Permalink
Add few more strong types for data structures
Browse files Browse the repository at this point in the history
  • Loading branch information
nivi-apple committed May 30, 2024
1 parent 62a6dfb commit 4dfad07
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/darwin/Framework/CHIPTests/MTRPerControllerStorageTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -2297,7 +2297,6 @@ - (void)testSubscriptionPool
[self doTestSubscriptionPoolWithSize:1 deviceOnboardingPayloads:deviceOnboardingPayloads];
[self doTestSubscriptionPoolWithSize:2 deviceOnboardingPayloads:deviceOnboardingPayloads];
}
}

- (MTRDevice *)getMTRDevice:(NSNumber *)deviceID
{
Expand Down Expand Up @@ -2489,7 +2488,7 @@ - (void)testDataStorageUpdatesWhenRemovingEndpoints
[self waitForExpectations:@[ attributeDataReceivedExpectation, reportEndExpectation ] timeout:60];

[controller.controllerDataStore clearAllStoredClusterData];
NSDictionary * storedClusterDataAfterClear = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID];
NSDictionary<MTRClusterPath *, MTRDeviceClusterData *> * storedClusterDataAfterClear = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID];
XCTAssertEqual(storedClusterDataAfterClear.count, 0);

[controller removeDevice:device];
Expand Down Expand Up @@ -2614,7 +2613,7 @@ - (void)testDataStorageUpdatesWhenRemovingClusters
[self waitForExpectations:@[ attributeDataReceivedExpectation, reportEndExpectation ] timeout:60];

[controller.controllerDataStore clearAllStoredClusterData];
NSDictionary * storedClusterDataAfterClear = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID];
NSDictionary<MTRClusterPath *, MTRDeviceClusterData *> * storedClusterDataAfterClear = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID];
XCTAssertEqual(storedClusterDataAfterClear.count, 0);

[controller removeDevice:device];
Expand Down Expand Up @@ -2683,10 +2682,10 @@ - (void)testDataStorageUpdatesWhenRemovingAttributes
XCTAssertNotNil(data);
XCTAssertNotNil(data.attributes);

NSDictionary * dict = [data.attributes objectForKey:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)];
MTRDeviceDataValueDictionary dict = [data.attributes objectForKey:@(MTRAttributeIDTypeGlobalAttributeAttributeListID)];
XCTAssertNotNil(dict);

NSMutableArray * persistedAttributes = [device arrayOfNumbersFromAttributeValue:dict];
NSMutableArray<NSNumber *> * persistedAttributes = [device arrayOfNumbersFromAttributeValue:dict];
initialTestAttributes = [device arrayOfNumbersFromAttributeValue:@ { MTRTypeKey : MTRArrayValueType, MTRValueKey : testClusterDataValue }];
XCTAssertNotNil(persistedAttributes);
for (NSNumber * attribute in initialTestAttributes) {
Expand Down Expand Up @@ -2770,7 +2769,7 @@ - (void)testDataStorageUpdatesWhenRemovingAttributes
[self waitForExpectations:@[ attributeDataReceivedExpectation, reportEndExpectation ] timeout:60];

[controller.controllerDataStore clearAllStoredClusterData];
NSDictionary * storedClusterDataAfterClear = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID];
NSDictionary<MTRClusterPath *, MTRDeviceClusterData *> * storedClusterDataAfterClear = [controller.controllerDataStore getStoredClusterDataForNodeID:deviceID];
XCTAssertEqual(storedClusterDataAfterClear.count, 0);

[controller removeDevice:device];
Expand Down

0 comments on commit 4dfad07

Please sign in to comment.