[Pkg-javascript-commits] [node-sha.js] 147/237: get tests working correctly

Bastien Roucariès rouca at moszumanska.debian.org
Fri May 5 09:03:49 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 01e393fbc4253ce82cf1f57f10c76b087a4b7787
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date:   Tue Sep 16 14:43:55 2014 +0300

    get tests working correctly
---
 test/test.js  |  1 -
 test/write.js | 93 -----------------------------------------------------------
 2 files changed, 94 deletions(-)

diff --git a/test/test.js b/test/test.js
index 66c089d..bc2156f 100644
--- a/test/test.js
+++ b/test/test.js
@@ -3,7 +3,6 @@ var crypto = require('crypto')
 var tape   = require('tape')
 var Sha1   = require('../').sha1
 var Uint32toHex = Sha1.Uint32toHex
-var u = require('../util')
 
 function generateCount (m) {
   var s = ''
diff --git a/test/write.js b/test/write.js
deleted file mode 100644
index 4f8146a..0000000
--- a/test/write.js
+++ /dev/null
@@ -1,93 +0,0 @@
-var tape = require('tape')
-var write = require('../util').write
-var hexpp = require('../hexpp')
-var u = require('../util')
-
-function toBuffer (string) {
-  var a = new Uint8Array(string.length)
-  for(var i = 0; i < string.length; i++)
-    a[i] = string.charCodeAt(i)
-  return a
-}
-
-var zero = '0'.charCodeAt(0)
-var A    = 'a'.charCodeAt(0)
-
-var HELLOTHERE = new Uint8Array([
-    104, 101, 108, 108,
-    111, 32, 116, 104,
-    101, 114, 101, 46
-  ])
-
-var FOOBARBAZ = new Uint8Array([
-    102, 111, 111,
-    98, 97, 114,
-    98, 97, 112
-  ])
-
-var FOO = toBuffer('foo')
-var BAR = toBuffer('bar')
-var BAZ = toBuffer('baz')
-
-var FOO64 = FOO.toString('base64')
-var BAR64 = BAR.toString('base64')
-var BAZ64 = BAZ.toString('base64')
-
-var FOOx = FOO.toString('hex')
-var BARx = BAR.toString('hex')
-var BAZx = BAZ.toString('hex')
-
-tape('hello there, ascii', function (t) {
-  var expected = HELLOTHERE
-  var actual = new Uint8Array(12)
-
-  write(actual, 'hello there.', 'ascii', 0, 0, 12)
-
-  console.log(hexpp(actual.buffer))
-  console.log(hexpp(expected.buffer))
-
-//  t.deepEqual(expected.buffer, actual.buffer)
-  equal(t, actual.buffer, expected.buffer)
-  t.end()
-})
-
-tape('foobarbaz, ascii', function (t) {
-  var actual = new Uint8Array(9)
-  var expected = FOOBARBAZ
-  write(actual, 'foo', 'ascii', 0, 0, 3)
-  write(actual, 'bar', 'ascii', 3, 0, 3)
-  write(actual, 'baz', 'ascii', 6, 0, 3)
-  console.log(hexpp(actual.buffer))
-  equal(t, actual.buffer, expected.buffer)
-  t.end()
-})
-
-console.log(FOO64, BAR64, BAZ64)
-
-function equal(t, a,b) {
-  t.equal(a.length, b.length)
-  for(var i = 0; i < a.length; i++)
-    t.equal(a[i], b[i])
-}
-
-tape('foobarbaz, ascii', function (t) {
-  var actual = new Uint8Array(9)
-  var expected = FOOBARBAZ
-  write(actual, FOO, null, 0, 0, 3)
-  write(actual, BAR, null, 3, 0, 3)
-  write(actual, BAZ, null, 6, 0, 3)
-  equal(t, actual.buffer, expected.buffer)
-  t.end()
-})
-
-tape('foobarbaz, hex', function (t) {
-  var actual = new Uint8Array(9)
-  var expected = FOOBARBAZ
-  write(actual, FOOx, 'hex', 0, 0, 3)
-  write(actual, BARx, 'hex', 3, 0, 3)
-  write(actual, BAZx, 'hex', 6, 0, 3)
-  equal(t, actual.buffer, expected.buffer)
-  t.end()
-})
-
-

-- 
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