A file of about `bytes`: C++ functions in a namespace, each with a brace initializer and two message sends.
(bytes: number)
| 594 | |
| 595 | /** A file of about `bytes`: C++ functions in a namespace, each with a brace initializer and two message sends. */ |
| 596 | function bigFile(bytes: number): { text: string; functions: number } { |
| 597 | const parts = ['#import <Foundation/Foundation.h>\n#include <vector>\n\nnamespace app {\n']; |
| 598 | let functions = 0; |
| 599 | for (let size = 0; size < bytes; functions++) { |
| 600 | const text = `static NSString *label${functions}(const std::string &name, int count) {\n std::vector<int> seen{count, ${functions}};\n NSString *text = [NSString stringWithUTF8String:name.c_str()];\n return [text stringByAppendingFormat:@"%d", seen.front()];\n}\n\n`; |
| 601 | parts.push(text); |
| 602 | size += text.length; |
| 603 | } |
| 604 | parts.push('}\n'); |
| 605 | return { text: parts.join(''), functions }; |
| 606 | } |
| 607 | |
| 608 | it('takes a file of sixteen thousand items in the time its size asks for', () => { |
| 609 | const time = (source: string): number => { |
no test coverage detected