MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / bigFile

Function bigFile

__tests__/objcpp-cpp-items.test.ts:596–606  ·  view source on GitHub ↗

A file of about `bytes`: C++ functions in a namespace, each with a brace initializer and two message sends.

(bytes: number)

Source from the content-addressed store, hash-verified

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 => {

Callers 1

Calls 2

pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected