a102f5cd7d
Building and testing the project via Xcode copies the resources into the testing bundle, which is not the case for SwiftPM. Hence the helper method, that tries loading the resource from the bundle first. If it is nil then the resource is loaded from the test module path directly.
34 lines
771 B
Objective-C
34 lines
771 B
Objective-C
//
|
|
// HTMLKitTokenizerPerformance.m
|
|
// HTMLKit
|
|
//
|
|
// Created by Iska on 23/03/15.
|
|
// Copyright (c) 2015 BrainCookie. All rights reserved.
|
|
//
|
|
|
|
#import <XCTest/XCTest.h>
|
|
#import "HTMLTokenizer.h"
|
|
#import "HTMLTokenizerStates.h"
|
|
#import "HTMLTokens.h"
|
|
#import "HTMLKitTestUtil.h"
|
|
|
|
@interface HTMLKitTokenizerPerformance : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation HTMLKitTokenizerPerformance
|
|
|
|
- (void)testTokenizerPerformance
|
|
{
|
|
NSString *path = [HTMLKitTestUtil pathForFixture:@"HTML Standard" ofType:@"html" inDirectory:@"Fixtures"];
|
|
|
|
NSString *string = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
|
|
|
|
[self measureBlock:^{
|
|
HTMLTokenizer *tokenizer = [[HTMLTokenizer alloc] initWithString:string];
|
|
[tokenizer allObjects];
|
|
}];
|
|
}
|
|
|
|
@end
|