]> git.codecow.com Git - nano25519.git/commitdiff
Remove extraneous tests.
authorChris Duncan <chris@zoso.dev>
Sat, 15 Aug 2026 07:57:59 +0000 (00:57 -0700)
committerChris Duncan <chris@zoso.dev>
Sat, 15 Aug 2026 07:57:59 +0000 (00:57 -0700)
test.mjs

index b4b515819436463ef47bf9f8e2638bb7db6b2a05..7c55e0999a5a70c43cef9d80ed4277be42c0ad09 100644 (file)
--- a/test.mjs
+++ b/test.mjs
@@ -342,40 +342,30 @@ failures += +!test
 
 // Check sync imports with byte inputs and preallocated output buffer
 outbuf = new Uint8Array(32)
-result = derive(NANO_ORG_VECTOR.privateKeyBytes, outbuf)
-test = overlaps(result, outbuf)
-test &&= [...result].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.publicKey.toLowerCase()
+derive(NANO_ORG_VECTOR.privateKeyBytes, outbuf)
 test &&= [...outbuf].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.publicKey.toLowerCase()
 check(`derive from private key bytes ${NANO_ORG_VECTOR.privateKey} and allocate result to output buffer`, test)
 passes += +test
 failures += +!test
 
 outbuf = new Uint8Array(64)
-result = sign(NANO_ORG_VECTOR.blockHashBytes, NANO_ORG_VECTOR.secretKeyBytes, outbuf)
-test = overlaps(result, outbuf)
-test &&= [...result].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.signature.toLowerCase()
+sign(NANO_ORG_VECTOR.blockHashBytes, NANO_ORG_VECTOR.secretKeyBytes, outbuf)
 test &&= [...outbuf].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.signature.toLowerCase()
 check(`sign message bytes ${NANO_ORG_VECTOR.blockHash} and allocate result to output buffer`, test)
 passes += +test
 failures += +!test
 
 outbuf = new Uint8Array(new ArrayBuffer(96), 0, 32)
-result = derive(NANO_ORG_VECTOR.privateKeyBytes, outbuf)
-test = overlaps(result, outbuf)
-test &&= [...result].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.publicKey.toLowerCase()
+derive(NANO_ORG_VECTOR.privateKeyBytes, outbuf)
 test &&= [...outbuf].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.publicKey.toLowerCase()
-test &&= [...new Uint8Array(result.buffer)].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() !== NANO_ORG_VECTOR.publicKey.toLowerCase()
 test &&= [...new Uint8Array(outbuf.buffer)].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() !== NANO_ORG_VECTOR.publicKey.toLowerCase()
 check(`derive from private key bytes ${NANO_ORG_VECTOR.privateKey} and allocate result to output buffer`, test)
 passes += +test
 failures += +!test
 
 outbuf = new Uint8Array(new ArrayBuffer(96), 0, 64)
-result = sign(NANO_ORG_VECTOR.blockHashBytes, NANO_ORG_VECTOR.secretKeyBytes, outbuf)
-test = overlaps(result, outbuf)
-test &&= [...result].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.signature.toLowerCase()
+sign(NANO_ORG_VECTOR.blockHashBytes, NANO_ORG_VECTOR.secretKeyBytes, outbuf)
 test &&= [...outbuf].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.signature.toLowerCase()
-test &&= [...new Uint8Array(result.buffer)].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() !== NANO_ORG_VECTOR.publicKey.toLowerCase()
 test &&= [...new Uint8Array(outbuf.buffer)].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() !== NANO_ORG_VECTOR.publicKey.toLowerCase()
 check(`sign message bytes ${NANO_ORG_VECTOR.blockHash} and allocate result to output buffer`, test)
 passes += +test
@@ -384,11 +374,8 @@ failures += +!test
 // Check sync imports with byte inputs and offset output buffer
 length = 33 + crypto.getRandomValues(new Uint8Array(1))[0]
 outbuf = new Uint8Array(new ArrayBuffer(length), length - 32, 32)
-result = derive(NANO_ORG_VECTOR.privateKeyBytes, outbuf)
-test = overlaps(result, outbuf)
-test &&= [...result].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.publicKey.toLowerCase()
+derive(NANO_ORG_VECTOR.privateKeyBytes, outbuf)
 test &&= [...outbuf].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.publicKey.toLowerCase()
-test &&= [...new Uint8Array(result.buffer)].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() !== NANO_ORG_VECTOR.publicKey.toLowerCase()
 test &&= [...new Uint8Array(outbuf.buffer)].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() !== NANO_ORG_VECTOR.publicKey.toLowerCase()
 check(`derive from private key bytes ${NANO_ORG_VECTOR.privateKey} to offset outbuf`, test)
 passes += +test
@@ -396,11 +383,8 @@ failures += +!test
 
 length = 65 + crypto.getRandomValues(new Uint8Array(1))[0]
 outbuf = new Uint8Array(new ArrayBuffer(length), length - 64, 64)
-result = sign(NANO_ORG_VECTOR.blockHashBytes, NANO_ORG_VECTOR.secretKeyBytes, outbuf)
-test = overlaps(result, outbuf)
-test &&= [...result].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.signature.toLowerCase()
+sign(NANO_ORG_VECTOR.blockHashBytes, NANO_ORG_VECTOR.secretKeyBytes, outbuf)
 test &&= [...outbuf].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() === NANO_ORG_VECTOR.signature.toLowerCase()
-test &&= [...new Uint8Array(result.buffer)].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() !== NANO_ORG_VECTOR.publicKey.toLowerCase()
 test &&= [...new Uint8Array(outbuf.buffer)].map(b => b.toString(16).padStart(2, '0')).join('').toLowerCase() !== NANO_ORG_VECTOR.publicKey.toLowerCase()
 check(`sign message bytes ${NANO_ORG_VECTOR.blockHash} to offset outbuf`, test)
 passes += +test