Skip to content

Commit 7cbb460

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 9ac61f3 commit 7cbb460

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

src/darwin/Framework/CHIPTests/MTRDeviceTests.m

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6768,7 +6768,7 @@ - (void)test055_WatchdogNoOpsWhenAdvertisementRacesAhead
67686768
// measured from setDelegate; by now both the advertisement-driven
67696769
// scheduling and the watchdog deadline are in the past.
67706770
XCTestExpectation * settle = [self expectationWithDescription:@"Watchdog window has elapsed"];
6771-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), queue, ^{
6771+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (2 * NSEC_PER_SEC)), queue, ^{
67726772
[settle fulfill];
67736773
});
67746774
[self waitForExpectations:@[ settle ] timeout:5];
@@ -6856,7 +6856,7 @@ - (void)test056_NodeMayBeAdvertisingOperationalAfterDeferralCompletes
68566856

68576857
// Allow time for any erroneous state churn to manifest.
68586858
XCTestExpectation * settle = [self expectationWithDescription:@"Post-establishment advertisement processed"];
6859-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), queue, ^{
6859+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (2 * NSEC_PER_SEC)), queue, ^{
68606860
[settle fulfill];
68616861
});
68626862
[self waitForExpectations:@[ settle ] timeout:5];
@@ -6967,7 +6967,7 @@ - (void)test057_LatchIsPerInstanceFreshDeviceDefersAgain
69676967
// (it's set synchronously inside _ensureSubscriptionForExistingDelegates,
69686968
// before any subsequent state transitions), poll a few times via a
69696969
// dispatch_after as a safety net so the assertion is robust on busy CI.
6970-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(100 * NSEC_PER_MSEC)), queue, ^{
6970+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (100 * NSEC_PER_MSEC)), queue, ^{
69716971
if ([[deviceB valueForKey:@"hasDeferredFirstThreadSubscription"] boolValue]) {
69726972
[deferralEnteredOnB fulfill];
69736973
}
@@ -7221,7 +7221,7 @@ - (void)test059_AdvertisementBeforeSetDelegateDoesNotPoisonDeferralGate
72217221
// _ensureSubscriptionForExistingDelegates before any state callback can
72227222
// fire, so a quick dispatch-after also fulfils the expectation if the
72237223
// initial state-change callback hasn't landed yet on busy CI.
7224-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(100 * NSEC_PER_MSEC)), queue, ^{
7224+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (100 * NSEC_PER_MSEC)), queue, ^{
72257225
if ([[device valueForKey:@"hasDeferredFirstThreadSubscription"] boolValue]) {
72267226
[latchSet fulfill];
72277227
}
@@ -7341,7 +7341,7 @@ - (void)test060_RemoveDeviceDuringDeferralWindowIsSafe
73417341
// we'd see a Subscribing transition (or worse, an InitialSubscriptionEstablished)
73427342
// recorded after `removeAt` in the transitions array.
73437343
XCTestExpectation * watchdogElapsed = [self expectationWithDescription:@"Watchdog window has elapsed"];
7344-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), queue, ^{
7344+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (3 * NSEC_PER_SEC)), queue, ^{
73457345
[watchdogElapsed fulfill];
73467346
});
73477347
[self waitForExpectations:@[ watchdogElapsed ] timeout:10];
@@ -7367,10 +7367,12 @@ - (void)test060_RemoveDeviceDuringDeferralWindowIsSafe
73677367
for (NSDictionary * transition in snapshot) {
73687368
XCTAssertNotEqualObjects(transition[@"state"], @(MTRInternalDeviceStateSubscribing),
73697369
@"Should not have reached Subscribing during the deferral window before removal; "
7370-
@"transitions=%@", snapshot);
7370+
@"transitions=%@",
7371+
snapshot);
73717372
XCTAssertNotEqualObjects(transition[@"state"], @(MTRInternalDeviceStateInitialSubscriptionEstablished),
73727373
@"Should not have reached Established during the deferral window before removal; "
7373-
@"transitions=%@", snapshot);
7374+
@"transitions=%@",
7375+
snapshot);
73747376
}
73757377

73767378
delegate.onInternalStateChanged = nil;
@@ -7463,7 +7465,8 @@ - (void)test061_WatchdogTimingIsApproximatelyOneSecond
74637465
// stays well within the budget.
74647466
XCTAssertLessThan(elapsed, 5.0,
74657467
@"Subscribing reached in %.3fs after deferral was armed — exceeds the 1s watchdog budget plus generous slack; "
7466-
@"a regression in kFirstThreadSubscribeWatchdogNs would land here", elapsed);
7468+
@"a regression in kFirstThreadSubscribeWatchdogNs would land here",
7469+
elapsed);
74677470

74687471
// End-state invariants: the deferring flag must be NO (cleared by the
74697472
// watchdog), the latch must remain YES, and no advertisement was needed.
@@ -7655,7 +7658,8 @@ - (void)test062_MultipleAdvertisementsDuringDeferralWindowOnlyFirstReentersEnsur
76557658
BOOL deferring = [s[@"deferring"] boolValue];
76567659
if (sawDeferringCleared && deferring) {
76577660
XCTFail(@"deferringFirstThreadSubscription transitioned NO->YES after being cleared; "
7658-
@"a regression in nodeMayBeAdvertisingOperational re-armed the flag. trace=%@", snapshot);
7661+
@"a regression in nodeMayBeAdvertisingOperational re-armed the flag. trace=%@",
7662+
snapshot);
76597663
break;
76607664
}
76617665
if (!deferring) {
@@ -7671,7 +7675,8 @@ - (void)test062_MultipleAdvertisementsDuringDeferralWindowOnlyFirstReentersEnsur
76717675
BOOL latch = [s[@"latch"] boolValue];
76727676
if (sawLatchSet && !latch) {
76737677
XCTFail(@"hasDeferredFirstThreadSubscription transitioned YES->NO; "
7674-
@"the latch must be one-shot for the MTRDevice instance's lifetime. trace=%@", snapshot);
7678+
@"the latch must be one-shot for the MTRDevice instance's lifetime. trace=%@",
7679+
snapshot);
76757680
break;
76767681
}
76777682
if (latch) {
@@ -7686,7 +7691,7 @@ - (void)test062_MultipleAdvertisementsDuringDeferralWindowOnlyFirstReentersEnsur
76867691
// strongest "no double-scheduling" assertion we can make from outside.
76877692
XCTAssertEqual(establishedTransitions, 1,
76887693
@"Subscription must establish exactly once across multi-advertisement-during-deferral; got %ld",
7689-
(long)establishedTransitions);
7694+
(long) establishedTransitions);
76907695

76917696
XCTAssertEqualObjects([device valueForKey:@"deferringFirstThreadSubscription"], @NO,
76927697
@"End state: deferral flag clear");
@@ -7843,7 +7848,7 @@ - (void)test064_InvalidateClearsFirstThreadSubscribeDeferralFlags
78437848
// Spin past the 1s watchdog deadline and re-sample. If the watchdog
78447849
// misbehaved and somehow set the flag back, we'd see it here.
78457850
XCTestExpectation * pastWatchdog = [self expectationWithDescription:@"Past 1s watchdog deadline"];
7846-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1500 * NSEC_PER_MSEC)), queue, ^{
7851+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (1500 * NSEC_PER_MSEC)), queue, ^{
78477852
[pastWatchdog fulfill];
78487853
});
78497854
[self waitForExpectations:@[ pastWatchdog ] timeout:5];
@@ -7908,7 +7913,7 @@ - (void)test065_SuspendDuringDeferralAbortsWatchdogScheduling
79087913

79097914
// Wait past the 1s watchdog deadline.
79107915
XCTestExpectation * pastWatchdog = [self expectationWithDescription:@"Past 1s watchdog deadline"];
7911-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1500 * NSEC_PER_MSEC)), queue, ^{
7916+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) (1500 * NSEC_PER_MSEC)), queue, ^{
79127917
[pastWatchdog fulfill];
79137918
});
79147919
[self waitForExpectations:@[ pastWatchdog ] timeout:5];
@@ -7923,7 +7928,7 @@ - (void)test065_SuspendDuringDeferralAbortsWatchdogScheduling
79237928
XCTAssertEqual(subscribingTransitionsAfterSuspend, 0,
79247929
@"Watchdog firing while subscriptions are not allowed must not schedule pool work; "
79257930
@"observed %ld Subscribing transitions",
7926-
(long)subscribingTransitionsAfterSuspend);
7931+
(long) subscribingTransitionsAfterSuspend);
79277932

79287933
// The deferring flag must end at NO regardless of which branch caught it.
79297934
XCTAssertEqualObjects([device valueForKey:@"deferringFirstThreadSubscription"], @NO,

0 commit comments

Comments
 (0)