From a132c84664ba430f7792e818d6bb59aaedd06692 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 16 Jan 2025 14:17:21 -0800 Subject: [PATCH] Pick out test page changes from other branch. --- test.html | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/test.html b/test.html index 587e004..e11a480 100644 --- a/test.html +++ b/test.html @@ -65,8 +65,8 @@ SPDX-License-Identifier: GPL-3.0-or-later console.log(`Geometric Mean: ${geometric} ms`) } - export async function run (size, effort, gl, debug) { - if (gl) NanoPow = NanoPowGl + export async function run (size, effort, isOutputShown, isGlForced, isDebug) { + if (isGlForced) NanoPow = NanoPowGl document.getElementById('status').innerHTML = `TESTING IN PROGRESS` console.log(`%cNanoPow`, 'color:green', 'Checking validate()') const expectFalse = await NanoPow.validate('0000000000000000', '0000000000000000000000000000000000000000000000000000000000000000') @@ -95,17 +95,18 @@ SPDX-License-Identifier: GPL-3.0-or-later let work = null const start = performance.now() try { - work = await NanoPow.search(hash, { effort, debug }) + work = await NanoPow.search(hash, { effort, debug: isDebug }) } catch (err) { document.getElementById('output').innerHTML += `Error: ${err.message}
` console.error(err) } const end = performance.now() + document.getElementById('status').innerHTML = `TESTING IN PROGRESS ${i}/${size}
` const isValid = (await NanoPow.validate(work, hash)) ? 'VALID' : 'INVALID' times.push(end - start) const msg = `${isValid} [${work}] ${hash} (${end - start} ms)` // console.log(msg) - document.getElementById('output').innerHTML += `${msg}
` + if (isOutputShown) document.getElementById('output').innerHTML += `${msg}
` } document.getElementById('output').innerHTML += `-----
` document.getElementById('summary').innerHTML += `NanoPow (${type})
${JSON.stringify(average(times), null, '\t')}
` @@ -135,9 +136,10 @@ SPDX-License-Identifier: GPL-3.0-or-later document.getElementById('go').addEventListener('click', e => { const size = document.getElementById('size') const effort = document.getElementById('effort') - const gl = document.getElementById('gl') - const debug = document.getElementById('debug') - run(size.value, effort.value, gl.checked, debug.checked) + const isOutputShown = document.getElementById('isOutputShown') + const isGlForced = document.getElementById('isGlForced') + const isDebug = document.getElementById('isDebug') + run(size.value, effort.value, isOutputShown.checked, isGlForced.checked, isDebug.checked) }) @@ -163,10 +165,12 @@ SPDX-License-Identifier: GPL-3.0-or-later - - - - + + + + + +

WAITING


-- 2.34.1