mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00

git-subtree-dir: submodules/AsyncDisplayKit git-subtree-mainline: d06f423e0ed3df1fed9bd10d79ee312a9179b632 git-subtree-split: 02bedc12816e251ad71777f9d2578329b6d2bef6
45 lines
1.5 KiB
Objective-C
45 lines
1.5 KiB
Objective-C
//
|
|
// ASPerformanceTestContext.h
|
|
// Texture
|
|
//
|
|
// Copyright (c) Pinterest, Inc. All rights reserved.
|
|
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import <XCTest/XCTestAssertionsImpl.h>
|
|
#import <AsyncDisplayKit/ASBaseDefines.h>
|
|
|
|
#define ASXCTAssertRelativePerformanceInRange(test, caseName, min, max) \
|
|
_XCTPrimitiveAssertLessThanOrEqual(self, test.results[caseName].relativePerformance, @#caseName, max, @#max);\
|
|
_XCTPrimitiveAssertGreaterThanOrEqual(self, test.results[caseName].relativePerformance, @#caseName, min, @#min)
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
typedef void (^ASTestPerformanceCaseBlock)(NSUInteger i, dispatch_block_t startMeasuring, dispatch_block_t stopMeasuring);
|
|
|
|
@interface ASPerformanceTestResult : NSObject
|
|
@property (nonatomic, readonly) NSTimeInterval timePer1000;
|
|
@property (nonatomic, readonly) NSString *caseName;
|
|
|
|
@property (nonatomic, readonly, getter=isReferenceCase) BOOL referenceCase;
|
|
@property (nonatomic, readonly) float relativePerformance;
|
|
|
|
@property (nonatomic, readonly) NSMutableDictionary *userInfo;
|
|
@end
|
|
|
|
@interface ASPerformanceTestContext : NSObject
|
|
|
|
/**
|
|
* The first case you add here will be considered the reference case.
|
|
*/
|
|
- (void)addCaseWithName:(NSString *)caseName block:(AS_NOESCAPE ASTestPerformanceCaseBlock)block;
|
|
|
|
@property (nonatomic, copy, readonly) NSDictionary<NSString *, ASPerformanceTestResult *> *results;
|
|
|
|
- (BOOL)areAllUserInfosEqual;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|