[Pkg-javascript-commits] [node-sha.js] 232/237: Fix testsuite

Bastien Roucariès rouca at moszumanska.debian.org
Fri May 5 09:04:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-sha.js.

commit b2a98a9b5b3ff4fa252402f4e7aa15bbc7dbd6f6
Author: Bastien ROUCARIÈS <roucaries.bastien at gmail.com>
Date:   Thu Apr 20 13:36:19 2017 +0200

    Fix testsuite
    
    Forwarded: no
---
 test/vectors.js | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/test/vectors.js b/test/vectors.js
index 4aef39c..e53e05a 100644
--- a/test/vectors.js
+++ b/test/vectors.js
@@ -10,15 +10,25 @@ function makeTest (alg, i, verbose) {
   var v = vectors[i]
 
   tape(alg + ': NIST vector ' + i, function (t) {
+    // nan test
+    if(v!=v) {
+	t.end();
+	return;
+	}
+    if(typeof(v)=='undefined') {
+	t.end();
+	return;
+    }
+    vinput = v != v ? v : (typeof(v) == 'undefined' ? v : v.input);
     if (verbose) {
       console.log(v)
       console.log('VECTOR', i)
-      console.log('INPUT', v.input)
-      console.log(hexpp(new Buffer(v.input, 'base64')))
-      console.log(new Buffer(v.input, 'base64').toString('hex'))
+      console.log('INPUT', vinput)
+      console.log(hexpp(new Buffer(vinput, 'base64')))
+      console.log(new Buffer(vinput, 'base64').toString('hex'))
     }
 
-    var buf = new Buffer(v.input, 'base64')
+    var buf = new Buffer(vinput, 'base64')
     t.equal(createHash(alg).update(buf).digest('hex'), v[alg])
 
     i = ~~(buf.length / 2)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-sha.js.git



More information about the Pkg-javascript-commits mailing list