Skip to content

Commit

Permalink
test: normalise the test for SQLite infinity
Browse files Browse the repository at this point in the history
Older SQLite used 1.0e999 as the printf output for an IEEE784 Inf value,

  https://sqlite.org/printf.html

whereas newer uses 9.0e+999. The difference doesn't matter for us, so
let's normalise to the later version.
  • Loading branch information
jordigh committed Nov 20, 2024
1 parent e513d6b commit ba0355f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/server/generateInitialDocSql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ describe('generateInitialDocSql', function() {
await execFile(path.join(getAppRoot(), 'buildtools/update_schema.sh'), [
newSchemaTs, newSqlTs,
], { env: process.env });
assert.equal((await fse.readFile(newSchemaTs)).toString(),
(await fse.readFile(currentSchemaTs)).toString());
assert.equal((await fse.readFile(newSqlTs)).toString(),
(await fse.readFile(currentSqlTs)).toString());

assert.equal(normaliseSQLiteInfinity((await fse.readFile(newSchemaTs)).toString()),
normaliseSQLiteInfinity((await fse.readFile(currentSchemaTs)).toString()));
assert.equal(normaliseSQLiteInfinity((await fse.readFile(newSqlTs)).toString()),
normaliseSQLiteInfinity((await fse.readFile(currentSqlTs)).toString()));
});
});

function normaliseSQLiteInfinity(sql: string) {
return sql.replace(/\b1e\+?999\b/g, '9.0e+999');
}

0 comments on commit ba0355f

Please sign in to comment.