Skip to content

Commit

Permalink
Adding Boris' test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
woody-apple committed Jul 2, 2022
1 parent f361442 commit dbae6e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
11 changes: 11 additions & 0 deletions src/darwin/Framework/CHIPTests/MTRDeviceTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -708,17 +708,28 @@ - (void)test011_ReadCachedAttribute
XCTestExpectation * subscribeExpectation = [self expectationWithDescription:@"Subscription complete"];

NSLog(@"Subscribing...");
__block void (^reportHandler)(NSArray * _Nullable value, NSError * _Nullable error);
[device subscribeWithQueue:queue
minInterval:2
maxInterval:60
params:nil
cacheContainer:attributeCacheContainer
attributeReportHandler:^(NSArray * value) {
NSLog(@"Received report: %@", value);
if (reportHandler) {
__auto_type handler = reportHandler;
reportHandler = nil;
handler(value, nil);
}
}
eventReportHandler:nil
errorHandler:^(NSError * error) {
NSLog(@"Received report error: %@", error);
if (reportHandler) {
__auto_type handler = reportHandler;
reportHandler = nil;
handler(nil, error);
}
}
subscriptionEstablished:^() {
[subscribeExpectation fulfill];
Expand Down
9 changes: 2 additions & 7 deletions src/darwin/Framework/CHIPTests/MTRTestKeys.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#import <Security/SecKey.h>

@interface MTRTestKeys ()
@property (readwrite) SecKeyRef privateKey;
@property (readwrite) SecKeyRef publicKey;
@property (readonly) SecKeyRef privateKey;
@property (readonly) SecKeyRef publicKey;
@end

@implementation MTRTestKeys
Expand Down Expand Up @@ -79,11 +79,6 @@ - (NSData *)signMessageECDSA_DER:(NSData *)message
return (__bridge_transfer NSData *) outData;
}

- (SecKeyRef)publicKey
{
return _publicKey;
}

- (void)dealloc
{
if (_publicKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ - (void)testThreadOperationalDataset
channel:25
panID:[NSData dataWithBytes:&panID length:sizeof(panID)]];
XCTAssertNotNil(dataset);
NSData * data = [dataset asData];
NSData * data = [dataset data];
XCTAssertNotNil(data);

MTRThreadOperationalDataset * reconstructed = [[MTRThreadOperationalDataset alloc] initWithData:data];
Expand Down

0 comments on commit dbae6e7

Please sign in to comment.