Browse files

Checking in changes prior to tagging of version 0.0.6.

Changelog diff is:

diff --git a/History.md b/History.md
index 4787460..572606e 100644
--- a/History.md
+++ b/History.md
@@ -1,8 +1,13 @@
+0.0.6 / 2011-11-10
+==================
+
+  * Using test module 'nodeunit'
+
 0.0.5 / 2011-11-06
 ==================

   * Change interface to async
-  * Add sync interface(*Sync())
+  * Add sync interface(Sync())

 0.0.4 / 2011-10-18
 ==================
  • Loading branch information...
1 parent 79f22a5 commit 8378f1689818a9ab12e56523aa55f39f9979429b @hideo55 committed Nov 10, 2011
Showing with 52 additions and 29 deletions.
  1. +6 −1 History.md
  2. +1 −1 lib/murmurhash3.js
  3. +4 −1 package.json
  4. +40 −25 test.js
  5. +1 −1 wscript
View
7 History.md
@@ -1,8 +1,13 @@
+0.0.6 / 2011-11-10
+==================
+
+ * Using test module 'nodeunit'
+
0.0.5 / 2011-11-06
==================
* Change interface to async
- * Add sync interface(*Sync())
+ * Add sync interface(Sync())
0.0.4 / 2011-10-18
==================
View
2 lib/murmurhash3.js
@@ -8,7 +8,7 @@
* Library version.
*/
-exports.version = '0.0.5';
+exports.version = '0.0.6';
var binding;
try {
View
5 package.json
@@ -1,11 +1,14 @@
{
"name": "murmurhash3"
- , "version": "0.0.5"
+ , "version": "0.0.6"
, "description": "Node binding of MurmurHash3"
, "repository" : "https://github.com/hideo55/node-murmurhash3"
, "keywords": []
, "author": "Hideaki Ohno <hide.o.j55@gmail.com>"
, "dependencies": {}
+ , "devDependencies" : {
+ "nodeunit": ""
+ }
, "main": "./lib/murmurhash3.js"
, "engines": { "node": ">=0.4.x" }
, "scripts": {
View
65 test.js
@@ -1,38 +1,53 @@
-var mmh3 = require('./lib/murmurhash3');
-var assert = require('assert');
+var mmh = mmh3 = require('./lib/murmurhash3');
+var testData = [["Hello", 0x12da77c8, [0x2360ae46, 0x5e6336c6, 0xad45b3f4, 0xad45b3f4]], ["Hello1", 0x6357e0a6, [0x8eb0cf41, 0x641b2401, 0xbc4c0dfc, 0xbc4c0dfc]], ["Hello2", 0xe5ce223e, [0xd3bcfc45, 0x66782162, 0x4beab2d1, 0x4beab2d1]]];
-var test_data = [["Hello", 0x12da77c8, [0x2360ae46, 0x5e6336c6, 0xad45b3f4, 0xad45b3f4]], ["Hello1", 0x6357e0a6, [0x8eb0cf41, 0x641b2401, 0xbc4c0dfc, 0xbc4c0dfc]], ["Hello2", 0xe5ce223e, [0xd3bcfc45, 0x66782162, 0x4beab2d1, 0x4beab2d1]]];
-
-for( i = 0; i < test_data.length; i++) {(function() {
- var val = test_data[i];
+exports.setUp = function(cb) {
+ cb();
+};
+for(var i = 0; i < testData.length; i++) {
+ var val = testData[i];
+ exports["testAsyncInterface32_" + i] = function(test) {
mmh3.murmur32(val[0], function(err, res) {
- assert.equal(res, val[1], 'murmur32-' + i);
+ test.equal(res, val[1], 'murmur32-' + i);
+ test.done();
});
+ };
+ exports["testAsyncInterface32Hex_" + i] = function(test) {
mmh3.murmur32Hex(val[0], function(err, res) {
- assert.equal(res, val[1].toString(16), 'murmur32Hex-' + i);
+ test.equal(res, val[1].toString(16), 'murmur32Hex-' + i);
+ test.done();
});
+ };
+ exports["testAsyncInterface128_" + i] = function(test) {
mmh3.murmur128(val[0], function(err, res) {
- assert.deepEqual(res, val[2], 'murmur128-' + i);
+ test.deepEqual(res, val[2], 'murmur128-' + i);
+ test.done();
});
+ };
+ exports["testAsyncInterface128Hex_" + i] = function(test) {
mmh3.murmur128Hex(val[0], function(err, res) {
var expect = '';
for(var j = 0; j < 4; j++) {
expect += val[2][j].toString(16);
}
- assert.equal(res, expect, 'murmur128Hex-' + i);
+ test.equal(res, expect, 'murmur128Hex-' + i);
+ test.done();
});
- var res;
- res = mmh3.murmur32Sync(val[0]);
- assert.equal(res, val[1], 'murmur32-' + i);
- res = mmh3.murmur32HexSync(val[0]);
- assert.equal(res, val[1].toString(16), 'murmur32Hex-' + i);
- res = mmh3.murmur128Sync(val[0]);
- assert.deepEqual(res, val[2], 'murmur128-' + i);
- res = mmh3.murmur128HexSync(val[0]);
- var expect = '';
- for(var j = 0; j < 4; j++) {
- expect += val[2][j].toString(16);
- }
- assert.equal(res, expect, 'murmur128Hex-' + i);
- })();
-}
+ };
+ exports["testSyncInterface_" + i] = function(test){
+ var res;
+ res = mmh3.murmur32Sync(val[0]);
+ test.equal(res, val[1], 'murmur32-' + i);
+ res = mmh3.murmur32HexSync(val[0]);
+ test.equal(res, val[1].toString(16), 'murmur32Hex-' + i);
+ res = mmh3.murmur128Sync(val[0]);
+ test.deepEqual(res, val[2], 'murmur128-' + i);
+ res = mmh3.murmur128HexSync(val[0]);
+ var expect = '';
+ for(var j = 0; j < 4; j++) {
+ expect += val[2][j].toString(16);
+ }
+ test.equal(res, expect, 'murmur128Hex-' + i);
+ test.done();
+ };
+}
View
2 wscript
@@ -17,5 +17,5 @@ def build(bld):
obj.source = './src/MurmurHash3.cpp ./src/bindings.cc'
def test(tst):
- test_binary = 'node'
+ test_binary = 'nodeunit'
Utils.exec_command(test_binary + ' test.js')

0 comments on commit 8378f16

Please sign in to comment.