mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 14:02:28 +00:00
Added simple performance test
Signed-off-by: michael starke <michael.starke@hicknhack-software.com>
This commit is contained in:
57
MacPassTests/KPKTestPerformance.m
Normal file
57
MacPassTests/KPKTestPerformance.m
Normal file
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// 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
|
||||
Reference in New Issue
Block a user