]> zoso.dev Git - nano-pow.git/commitdiff
Change testing output based on which API is loaded. Show a little more context on...
authorChris Duncan <chris@zoso.dev>
Sun, 12 Jan 2025 23:13:59 +0000 (15:13 -0800)
committerChris Duncan <chris@zoso.dev>
Sun, 12 Jan 2025 23:13:59 +0000 (15:13 -0800)
test.html

index 320ec3ed54ab3064b605b9af0ac6a7e7988fe662..72b74843b7f07643c1453691f83fc24446aaff14 100644 (file)
--- 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<br/>`
+               document.getElementById('output').innerHTML += `Now testing: NanoPow (${type})<br/>`
                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}<br/>`
                }
                document.getElementById('output').innerHTML += `-----<br/>`
-               document.getElementById('summary').innerHTML += `NanoPow<br/>${JSON.stringify(average(times), null, '\t')}<br/>`
+               document.getElementById('summary').innerHTML += `NanoPow (${type})<br/>${JSON.stringify(average(times), null, '\t')}<br/>`
                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<br/>${JSON.stringify(average(times), null, '\t')}<br/>`
                print(times)
 
+               document.getElementById('status').innerHTML = `TESTING COMPLETE<br/>`
                console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold')
        </script>
        <style>body{background:black;color:white;}a{color:darkcyan;}</style>
@@ -167,6 +168,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
        <p>nano-webgl-pow is the original package from which NanoPow was inspired and optimized.</p>
        <p>Times below are in milliseconds and summarized by various averaging methods.</p>
        <hr/>
+       <h3 id="status">TESTING IN PROGRESS</h3>
+       <hr/>
        <pre id="summary"></pre>
        <hr/>
        <pre id="output"></pre>