From 1ba8a79f806e15354637fd9494cf95d2ae1cacbd Mon Sep 17 00:00:00 2001 From: Prianka Liz Kariat Date: Thu, 30 Mar 2023 22:22:24 +0530 Subject: [PATCH] Updated expected fullfilment count of async calls in test --- .../vision/image_classifier/ImageClassifierTests.swift | 7 ++++--- .../test/vision/image_classifier/MPPImageClassifierTests.m | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mediapipe/tasks/ios/test/vision/image_classifier/ImageClassifierTests.swift b/mediapipe/tasks/ios/test/vision/image_classifier/ImageClassifierTests.swift index 837319d6f..5aa5f32ee 100644 --- a/mediapipe/tasks/ios/test/vision/image_classifier/ImageClassifierTests.swift +++ b/mediapipe/tasks/ios/test/vision/image_classifier/ImageClassifierTests.swift @@ -798,11 +798,12 @@ class ImageClassifierTests: XCTestCase { // expectation is not fullfilled for the specified `expectedFulfillmentCount`. // Since in our case we cannot predict how many times the expectation is // supposed to be fullfilled setting, - // `expectation.expectedFulfillmentCount` = `iterationCount` and + // `expectation.expectedFulfillmentCount` = `iterationCount` + 1 and // `expectation.isInverted = true` ensures that test succeeds if - // expectation is not fullfilled `iterationCount` times. + // expectation is fullfilled <= `iterationCount` times. let expectation = expectation(description: "liveStreamClassify") - expectation.expectedFulfillmentCount = iterationCount; + + expectation.expectedFulfillmentCount = iterationCount + 1; expectation.isInverted = true; imageClassifierOptions.completion = {( diff --git a/mediapipe/tasks/ios/test/vision/image_classifier/MPPImageClassifierTests.m b/mediapipe/tasks/ios/test/vision/image_classifier/MPPImageClassifierTests.m index 472dbe98f..b31025fbb 100644 --- a/mediapipe/tasks/ios/test/vision/image_classifier/MPPImageClassifierTests.m +++ b/mediapipe/tasks/ios/test/vision/image_classifier/MPPImageClassifierTests.m @@ -670,13 +670,13 @@ static NSString *const kExpectedErrorDomain = @"com.google.mediapipe.tasks"; // expectation is not fullfilled for the specified `expectedFulfillmentCount`. // Since in our case we cannot predict how many times the expectation is // supposed to be fullfilled setting, - // `expectation.expectedFulfillmentCount` = `iterationCount` and + // `expectation.expectedFulfillmentCount` = `iterationCount` + 1 and // `expectation.isInverted = true` ensures that test succeeds if - // expectation is not fullfilled `iterationCount` times. + // expectation is fullfilled <= `iterationCount` times. XCTestExpectation *expectation = [[XCTestExpectation alloc] initWithDescription:@"classifyWithLiveStream"]; - expectation.expectedFulfillmentCount = iterationCount; + expectation.expectedFulfillmentCount = iterationCount + 1; expectation.inverted = YES; options.runningMode = MPPRunningModeLiveStream;