From: Chris Duncan Date: Sun, 12 Jan 2025 23:13:59 +0000 (-0800) Subject: Change testing output based on which API is loaded. Show a little more context on... X-Git-Tag: v1.2.0~4 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=50871427509c3559619be9fb7f64375270705fdc;p=nano-pow.git Change testing output based on which API is loaded. Show a little more context on testing progress. --- diff --git a/test.html b/test.html index 320ec3e..72b7484 100644 --- a/test.html +++ b/test.html @@ -59,15 +59,15 @@ SPDX-License-Identifier: GPL-3.0-or-later console.log(`Geometric Mean: ${geometric} ms`) } - console.log(`%cNanoPow`, 'color:green', 'Testing validation function') + console.log(`%cNanoPow`, 'color:green', 'Checking validate()') const expectFalse = await NanoPow.validate('0000000000000000', '0000000000000000000000000000000000000000000000000000000000000000') console.log(`validate() output for bad nonce is ${expectFalse === false ? 'correct' : 'incorrect'}`) const expectTrue = await NanoPow.validate('47c83266398728cf', '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D') console.log(`validate() output for good nonce is ${expectTrue === true ? 'correct' : 'incorrect'}`) - - console.log(`%cNanoPow `, 'color:green', `Calculate proof-of-work for ${COUNT} unique send block hashes`) + const type = (NanoPow === NanoPowGpu) ? 'WebGPU' : (NanoPow === NanoPowGl) ? 'WebGL' : 'unknown API' + console.log(`%cNanoPow (${type})`, 'color:green', `Calculate proof-of-work for ${COUNT} unique send block hashes`) times = [] - document.getElementById('output').innerHTML += `Now testing: NanoPow
` + document.getElementById('output').innerHTML += `Now testing: NanoPow (${type})
` for (let i = 0; i < COUNT; i++) { const hash = random() let work = null @@ -87,7 +87,7 @@ SPDX-License-Identifier: GPL-3.0-or-later document.getElementById('output').innerHTML += `${msg}
` } document.getElementById('output').innerHTML += `-----
` - document.getElementById('summary').innerHTML += `NanoPow
${JSON.stringify(average(times), null, '\t')}
` + document.getElementById('summary').innerHTML += `NanoPow (${type})
${JSON.stringify(average(times), null, '\t')}
` print(times) console.log(`%cNanoPowGpu `, 'color:green', `Calculate proof-of-work for ${COUNT} unique send block hashes`) @@ -153,6 +153,7 @@ SPDX-License-Identifier: GPL-3.0-or-later document.getElementById('summary').innerHTML += `nano-webgl-pow
${JSON.stringify(average(times), null, '\t')}
` print(times) + document.getElementById('status').innerHTML = `TESTING COMPLETE
` console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold') @@ -167,6 +168,8 @@ SPDX-License-Identifier: GPL-3.0-or-later

nano-webgl-pow is the original package from which NanoPow was inspired and optimized.

Times below are in milliseconds and summarized by various averaging methods.


+

TESTING IN PROGRESS

+