mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-19 11:16:31 +00:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
|
export type FlameGraphNode = {
|
||
|
fn: number;
|
||
|
acc: number;
|
||
|
parent: number;
|
||
|
children: FlameGraphNode[];
|
||
|
};
|
||
|
|
||
|
export function flameGraphData(): FlameGraphNode {
|
||
|
return JSON.parse(
|
||
|
`{"fn":0,"acc":257,"parent":0,"children":[{"fn":18,"acc":251,"parent":0,"children":[{"fn":12,"acc":30,"parent":1,"children":[]}]}]}`,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
export function codeData() {
|
||
|
return `\
|
||
|
fn add(a, b) {
|
||
|
+ a b
|
||
|
}
|
||
|
|
||
|
let result = 0;
|
||
|
let i = 0;
|
||
|
loop {
|
||
|
if >= i 10 {
|
||
|
break;
|
||
|
}
|
||
|
result = add(result, 5);
|
||
|
i = + i 1;
|
||
|
}
|
||
|
`;
|
||
|
}
|
||
|
|
||
|
export type CodeCovEntry = {
|
||
|
index: number;
|
||
|
line: number;
|
||
|
col: number;
|
||
|
covers: number;
|
||
|
};
|
||
|
|
||
|
export function codeCoverageData(): CodeCovEntry[] {
|
||
|
return JSON.parse(
|
||
|
`[{"index":0,"line":1,"col":1,"covers":2},{"index":28,"line":5,"col":1,"covers":1},{"index":44,"line":6,"col":1,"covers":1},{"index":55,"line":7,"col":1,"covers":1},{"index":66,"line":8,"col":5,"covers":11},{"index":104,"line":11,"col":5,"covers":10},{"index":19,"line":2,"col":5,"covers":10},{"index":133,"line":12,"col":5,"covers":10},{"index":87,"line":9,"col":9,"covers":1}]`,
|
||
|
);
|
||
|
}
|