hashmap-native
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "hashmap-native", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Native hashmap for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -17,15 +17,15 @@ 'use strict'; | ||
].forEach(function (it) { | ||
var keyType = it.keyType; | ||
var valueType = it.valueType; | ||
var keys = data[it.keyType]; | ||
var values = data[it.valueType]; | ||
suite('hashmap-' + keyType + '-' + valueType, function() { | ||
suite('hashmap-' + it.keyType + '-' + it.valueType, function() { | ||
var map; | ||
setup(function() { | ||
map = new HashMap[keyType][valueType](); | ||
map = new HashMap[it.keyType][it.valueType](); | ||
}); | ||
test('put(), get(), contains()', function () { | ||
var key = data[keyType][0]; | ||
var value = data[valueType][0]; | ||
var key = keys[0]; | ||
var value = values[0]; | ||
@@ -40,8 +40,8 @@ // put new element | ||
// test missing element | ||
assert(!map.contains(data[keyType][1])); | ||
assert(!map.contains(keys[1])); | ||
}); | ||
test('remove()', function () { | ||
var key = data[keyType][0]; | ||
var value = data[valueType][0]; | ||
var key = keys[0]; | ||
var value = values[0]; | ||
@@ -56,7 +56,7 @@ map.put(key, value); | ||
test('size()', function () { | ||
var key1 = data[keyType][0]; | ||
var value1 = data[valueType][0]; | ||
var key1 = keys[0]; | ||
var value1 = values[0]; | ||
var key2 = data[keyType][1]; | ||
var value2 = data[valueType][1]; | ||
var key2 = keys[1]; | ||
var value2 = values[1]; | ||
@@ -73,4 +73,4 @@ assert(map.size() === 0); | ||
test('clear()', function () { | ||
var key = data[keyType][0]; | ||
var value = data[valueType][0]; | ||
var key = keys[0]; | ||
var value = values[0]; | ||
@@ -87,4 +87,4 @@ assert(map.size() === 0); | ||
test('empty()', function () { | ||
var key = data[keyType][0]; | ||
var value = data[valueType][0]; | ||
var key = keys[0]; | ||
var value = values[0]; | ||
@@ -96,3 +96,26 @@ assert(map.empty()); | ||
}); | ||
test('iterator()', function () { | ||
var tuple1 = [keys[0], values[0]]; | ||
var tuple2 = [keys[1], values[1]]; | ||
var entry; | ||
map.put(tuple1[0], tuple1[1]); | ||
map.put(tuple2[0], tuple2[1]); | ||
var it = map.iterator(); | ||
assert(it.hasNext()); | ||
entry = it.next(); | ||
assert(keys.indexOf(entry[0]) !== -1); | ||
assert(values.indexOf(entry[1]) !== -1); | ||
assert(it.hasNext()); | ||
entry = it.next(); | ||
assert(keys.indexOf(entry[0]) !== -1); | ||
assert(values.indexOf(entry[1]) !== -1); | ||
assert(!it.hasNext()); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12398
86