mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 07:02:39 +00:00
58 lines
1.3 KiB
Objective-C
58 lines
1.3 KiB
Objective-C
//
|
|
// KPKTestPerformance.m
|
|
// MacPass
|
|
//
|
|
// Created by Michael Starke on 21/10/15.
|
|
// Copyright © 2015 HicknHack Software GmbH. All rights reserved.
|
|
//
|
|
|
|
#import <XCTest/XCTest.h>
|
|
#import "KPKEntry.h"
|
|
#import "KPKAttribute.h"
|
|
#import "KPKFormat.h"
|
|
|
|
NSUInteger const _kKPKEntryCount = 1000;
|
|
|
|
@interface KPKTestPerformance : XCTestCase {
|
|
KPKEntry *testEntry;
|
|
}
|
|
@end
|
|
|
|
@implementation KPKTestPerformance
|
|
|
|
- (void)setUp {
|
|
[super setUp];
|
|
testEntry = [[KPKEntry alloc] init];
|
|
NSUInteger count = _kKPKEntryCount;
|
|
while(count-- > 0) {
|
|
[testEntry addCustomAttribute:[[KPKAttribute alloc] initWithKey:@(count).stringValue
|
|
value:@(count).stringValue]];
|
|
}
|
|
}
|
|
|
|
- (void)tearDown {
|
|
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
|
[super tearDown];
|
|
}
|
|
|
|
- (void)testAttributeLookupPerformanceA {
|
|
[self measureBlock:^{
|
|
[testEntry customAttributeForKey:@(0).stringValue];
|
|
}];
|
|
}
|
|
|
|
- (void)testAttributeLookupPerformanceB {
|
|
[self measureBlock:^{
|
|
[testEntry customAttributeForKey:@(_kKPKEntryCount - 1).stringValue];
|
|
}];
|
|
}
|
|
|
|
- (void)testAttributeLookupPerformanceC {
|
|
[self measureBlock:^{
|
|
[testEntry customAttributeForKey:kKPKTitleKey];
|
|
}];
|
|
}
|
|
|
|
|
|
@end
|