MCPcopy Create free account
hub / github.com/Singular/Singular / Main

Function Main

ppcc/adlib/test1.cc:37–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35static const int max_depth = 15; // 2^16-1 nodes.
36
37void Main() {
38 Str *cmd = new Str(CMD);
39 StrArr *args = (new Str(ARGS))->split(' ');
40 Int n = 0;
41 Str *output;
42 for (int j = 0; j < iter; j++) {
43 output = ReadProcess(cmd, args);
44 n += output->len();
45 }
46 Check(n == iter * 48894, "read process output as bytes");
47 Node *tree;
48 static Node *permtree;
49 Int counter;
50 counter = 0;
51 GCVar(permtree, make_tree(max_depth, counter));
52 for (int i = 0; i < iter; i++) {
53 counter = 0;
54 tree = make_tree(max_depth, counter);
55 }
56 // This may overflow on 32-bit machines, so we use unsigned
57 // modulo arithmetic without division.
58 Check(sum_tree(tree) * 2 == counter * (counter - 1),
59 "stress test memory allocation");
60 Check(NormalizePath(S("/foo/x/../bar/./"))->eq("/foo/bar"), "normalize path");
61 Check(BaseName(ProgramPath())->eq("test1"), "program path");
62}

Callers

nothing calls this directly

Calls 12

ReadProcessFunction · 0.85
CheckFunction · 0.85
GCVarFunction · 0.85
make_treeFunction · 0.85
sum_treeFunction · 0.85
NormalizePathFunction · 0.85
BaseNameFunction · 0.85
ProgramPathFunction · 0.85
splitMethod · 0.80
SFunction · 0.70
lenMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected