MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / checkSimplification

Function checkSimplification

test/compute-engine/random.test.ts:19–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17 */
18
19const ce = new ComputeEngine();
20
21const evaluate = (mathjson: any): string =>
22 ce.box(mathjson).evaluate().toString();
23
24const values = (mathjson: any): (number | undefined)[] =>
25 [...ce.box(mathjson).evaluate().each()].map((x) => x.re);
26
27/** The `n`-th draw of a frame seeded `seed`, computed independently of the
28 * engine — the reference the draw-consumption probes compare against. */
29function expectedDraw(seed: number | string, n: number): number {
30 const [lo, hi] = foldSeed(seed);
31 return frameDraw(lo, hi, n);
32}
33
34/**
35 * How many draws `body` consumed inside a frame: evaluate
36 * `WithRandomSeed(seed, Block(body, Random()))` and identify the trailing
37 * draw's index in the frame's stream.

Callers 1

random.test.tsFile · 0.85

Calls 7

forgetMethod · 0.65
evaluateMethod · 0.65
exprMethod · 0.65
simplifyMethod · 0.65
assignMethod · 0.65
isEqualMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected