]> zoso.dev Git - nano-pow.git/commitdiff
Cancel test if validate is not working.
authorChris Duncan <chris@zoso.dev>
Tue, 14 Jan 2025 15:21:17 +0000 (07:21 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 14 Jan 2025 15:21:17 +0000 (07:21 -0800)
test.html

index 95b77de80fa26b94e8ba3dd17101a278bfea3f1a..b5d0d882b6efa18e7fb3e44380ee44e47e3115b7 100644 (file)
--- a/test.html
+++ b/test.html
@@ -71,6 +71,15 @@ SPDX-License-Identifier: GPL-3.0-or-later
                        const expectTrue = await NanoPow.validate('47c83266398728cf', '92BA74A7D6DC7557F3EDA95ADC6341D51AC777A0A6FF0688A5C492AB2B2CB40D')
                        console.log(`validate() output for good nonce is ${expectTrue === true ? 'correct' : 'incorrect'}`)
                        const type = (NanoPow === NanoPowGpu) ? 'WebGPU' : (NanoPow === NanoPowGl) ? 'WebGL' : 'unknown API'
+
+                       try {
+                               if (expectFalse || !expectTrue) throw new Error(`Validation is not working`)
+                       } catch (err) {
+                               document.getElementById('output').innerHTML += `Error: ${err.message}<br/>`
+                               console.error(err)
+                               return
+                       }
+
                        console.log(`%cNanoPow (${type})`, 'color:green', `Calculate proof-of-work for ${COUNT} unique send block hashes`)
                        const times = []
                        document.getElementById('output').innerHTML += `Now testing: NanoPow (${type})<br/>`
@@ -115,7 +124,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
        <p>NanoPow uses WebGL 2.0 as a fallback option if WebGPU is not detected.</p>
        <p>Times below are in milliseconds and summarized by various averaging methods.</p>
        <hr />
-       <input id="count" type="number" value="20" />
+       <input id="count" type="number" value="2" />
        <button id="go">Go</button>
        <h3 id="status">WAITING</h3>
        <hr />