7fb04f3394
Instead of loading and running the HTML5Lib test files manually, the Xcode test cases are generated on start for all the HTML5Lib tokenizer tests. Also, the performance test is moved into its own class. This setup shouldn't require any extra maintenance when HTML5Lib adds new tokenizer test cases.
38 lines
836 B
Objective-C
38 lines
836 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"
|
|
|
|
@interface HTMLKitTokenizerPerformance : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation HTMLKitTokenizerPerformance
|
|
|
|
- (void)testTokenizerPerformance
|
|
{
|
|
NSString *path = [[NSBundle bundleForClass:self.class] resourcePath];
|
|
path = [path stringByAppendingPathComponent:@"HTML Standard.html"];
|
|
|
|
NSString *string = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil];
|
|
|
|
[self measureBlock:^{
|
|
HTMLTokenizer *tokenizer = [[HTMLTokenizer alloc] initWithString:string];
|
|
|
|
id token = nil;
|
|
do {
|
|
token = [tokenizer nextObject];
|
|
} while (token != nil);
|
|
}];
|
|
}
|
|
|
|
@end
|