(conf)
| 13 | }); |
| 14 | |
| 15 | function main(conf) { |
| 16 | const optionsObj = conf.options === 'none' ? {} : conf.options.split('|').reduce((acc, key) => { |
| 17 | acc[key] = true; |
| 18 | return acc; |
| 19 | }, {}); |
| 20 | |
| 21 | const db = new sqlite.DatabaseSync(':memory:', optionsObj); |
| 22 | |
| 23 | db.exec( |
| 24 | 'CREATE TABLE foo (text_column TEXT, integer_column INTEGER, real_column REAL, blob_column BLOB)', |
| 25 | ); |
| 26 | |
| 27 | const fooInsertStatement = db.prepare( |
| 28 | 'INSERT INTO foo (text_column, integer_column, real_column, blob_column) VALUES (?, ?, ?, ?)', |
| 29 | ); |
| 30 | |
| 31 | for (let i = 0; i < conf.tableSeedSize; i++) { |
| 32 | fooInsertStatement.run( |
| 33 | crypto.randomUUID(), |
| 34 | Math.floor(Math.random() * 100), |
| 35 | Math.random(), |
| 36 | Buffer.from('example blob data'), |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | let i; |
| 41 | let deadCodeElimination; |
| 42 | |
| 43 | const stmt = db.prepare(conf.statement); |
| 44 | |
| 45 | bench.start(); |
| 46 | for (i = 0; i < conf.n; i += 1) deadCodeElimination = stmt.get(); |
| 47 | bench.end(conf.n); |
| 48 | |
| 49 | assert.ok(deadCodeElimination !== undefined); |
| 50 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…