eyeprolog 1.3.18 → 1.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/test/run-regression.mjs +9 -9
package/package.json
CHANGED
package/test/run-regression.mjs
CHANGED
|
@@ -2189,7 +2189,7 @@ child.stdin.write(\`consult(${consultedAtom}).\\n\`);
|
|
|
2189
2189
|
{
|
|
2190
2190
|
name: 'npm exec can run package CLI bin from checkout',
|
|
2191
2191
|
run: () => {
|
|
2192
|
-
const result = spawnSync('npm', ['exec', '--loglevel=silent', '--yes', '--package=.', '--', 'eyeprolog', '--version'], {
|
|
2192
|
+
const result = spawnSync('npm', ['exec', '--offline', '--loglevel=silent', '--yes', '--package=.', '--', 'eyeprolog', '--version'], {
|
|
2193
2193
|
cwd: packageRoot,
|
|
2194
2194
|
encoding: 'utf8',
|
|
2195
2195
|
env: { ...process.env, npm_config_update_notifier: 'false' },
|
|
@@ -3797,30 +3797,30 @@ answer(ok) :-
|
|
|
3797
3797
|
`;
|
|
3798
3798
|
const script = `
|
|
3799
3799
|
import { Program, Solver, Env, parseGoalText, getEyePrologRegistry } from ${JSON.stringify(engineUrl)};
|
|
3800
|
-
const program = Program.parse(${JSON.stringify(programText)}, { autoloadGoals: ['ti(R,
|
|
3800
|
+
const program = Program.parse(${JSON.stringify(programText)}, { autoloadGoals: ['ti(R,1,0)'] });
|
|
3801
3801
|
const listTailGroup = program.findGroup('...', 2, 'user');
|
|
3802
3802
|
if (listTailGroup?.listTailRecursive !== true) {
|
|
3803
3803
|
throw new Error('recursive DCG tail-consumption was not recognized');
|
|
3804
3804
|
}
|
|
3805
3805
|
const solver = new Solver(program, { registry: getEyePrologRegistry(), maxMemoryBytes: Infinity });
|
|
3806
|
-
const goal = parseGoalText('ti(R,
|
|
3806
|
+
const goal = parseGoalText('ti(R,1,0)', {
|
|
3807
3807
|
doubleQuotes: 'chars',
|
|
3808
3808
|
operatorDefinitions: [...program.operators.values()],
|
|
3809
3809
|
});
|
|
3810
3810
|
let count = 0;
|
|
3811
3811
|
for (const _ of solver.solve([goal], new Env(), 0)) {
|
|
3812
|
-
if (++count ===
|
|
3812
|
+
if (++count === 10) break;
|
|
3813
3813
|
}
|
|
3814
|
-
if (count !==
|
|
3814
|
+
if (count !== 10) throw new Error('unexpected checkpoint count: ' + count);
|
|
3815
3815
|
const scope = solver.innerTableScopes.get('phrase');
|
|
3816
3816
|
if (scope == null) throw new Error('missing phrase table scope');
|
|
3817
3817
|
if (scope.memo.size !== 0) throw new Error('distinct tail-DCG inputs should not retain phrase tables: ' + scope.memo.size);
|
|
3818
3818
|
process.stdout.write(count + ':' + scope.memo.size);
|
|
3819
3819
|
`;
|
|
3820
3820
|
const result = spawnSync(process.execPath, [
|
|
3821
|
-
// This
|
|
3822
|
-
//
|
|
3823
|
-
//
|
|
3821
|
+
// This covers 100 accepted number candidates, enough to exercise
|
|
3822
|
+
// many distinct recursive DCG inputs while keeping this a focused
|
|
3823
|
+
// bounded-cache regression rather than a memory stress benchmark.
|
|
3824
3824
|
'--max-old-space-size=32',
|
|
3825
3825
|
'--input-type=module',
|
|
3826
3826
|
'--eval',
|
|
@@ -3829,7 +3829,7 @@ answer(ok) :-
|
|
|
3829
3829
|
if (result.error) throw result.error;
|
|
3830
3830
|
assertEqual(result.status, 0, `bounded phrase-table child status; stderr=${result.stderr}`);
|
|
3831
3831
|
const [countText, cacheText] = result.stdout.trim().split(':');
|
|
3832
|
-
assertEqual(countText, '
|
|
3832
|
+
assertEqual(countText, '10', 'recursive phrase checkpoints');
|
|
3833
3833
|
assertEqual(cacheText, '0', 'distinct tail-DCG phrase cache');
|
|
3834
3834
|
},
|
|
3835
3835
|
},
|