]> zoso.dev Git - nano-pow.git/commitdiff
Eliminate redundant console print function. Pass threshold of zero for test compariso...
authorChris Duncan <chris@zoso.dev>
Mon, 20 Jan 2025 06:07:36 +0000 (22:07 -0800)
committerChris Duncan <chris@zoso.dev>
Mon, 20 Jan 2025 06:07:36 +0000 (22:07 -0800)
test.html

index 9699386d8d81a4f06e3553ae0d647ea052df3318..10dc52f8cb1db3d1fdbeb06ed14676c612ee04f7 100644 (file)
--- a/test.html
+++ b/test.html
@@ -60,19 +60,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
                        }
                }
 
-               function print (times) {
-                       const { arithmetic, count, geometric, harmonic, min, max, rate, total, truncated } = average(times)
-                       console.log(`Count: ${count} nonces`)
-                       console.log(`Total: ${total} ms`)
-                       console.log(`Rate: ${rate} nonces/second`)
-                       console.log(`Minimum: ${min} ms`)
-                       console.log(`Maximum: ${max} ms`)
-                       console.log(`Arithmetic Mean: ${arithmetic} ms`)
-                       console.log(`Truncated Mean: ${truncated} ms`)
-                       console.log(`Harmonic Mean: ${harmonic} ms`)
-                       console.log(`Geometric Mean: ${geometric} ms`)
-               }
-
                export async function run (size, effort, isOutputShown, isGlForced, isDebug) {
                        if (isGlForced) NanoPow = NanoPowGl
                        document.getElementById('status').innerHTML = `TESTING IN PROGRESS 0/${size}`
@@ -103,13 +90,13 @@ SPDX-License-Identifier: GPL-3.0-or-later
                                let work = null
                                const start = performance.now()
                                try {
-                                       work = await NanoPow.search(hash, { effort, debug: isDebug })
+                                       work = await NanoPow.search(hash, { threshold: 0, effort, debug: isDebug })
                                } catch (err) {
                                        document.getElementById('output').innerHTML += `Error: ${err.message}<br/>`
                                        console.error(err)
                                }
                                const end = performance.now()
-                               const isValid = (await NanoPow.validate(work, hash)) ? 'VALID' : 'INVALID'
+                               const isValid = (await NanoPow.validate(work, hash, { threshold: 0 })) ? 'VALID' : 'INVALID'
                                times.push(end - start)
                                const msg = `${isValid} [${work}] ${hash} (${end - start} ms)`
                                // console.log(msg)
@@ -117,7 +104,6 @@ SPDX-License-Identifier: GPL-3.0-or-later
                        }
                        document.getElementById('output').innerHTML += `<hr/>`
                        document.getElementById('summary').innerHTML += `${JSON.stringify(average(times, effort), null, '\t')}<br/>`
-                       print(times)
                        document.getElementById('status').innerHTML = `TESTING COMPLETE<br/>`
                        console.log('%cTESTING COMPLETE', 'color:orange;font-weight:bold')
                }