diff --git a/test/unit/jasmine-boot.js b/test/unit/jasmine-boot.js
index 145164d1c..fd2bc64a3 100644
--- a/test/unit/jasmine-boot.js
+++ b/test/unit/jasmine-boot.js
@@ -49,14 +49,15 @@ function initializePDFJS(callback) {
'pdfjs/core/fonts', 'pdfjs/core/ps_parser', 'pdfjs/core/function',
'pdfjs/core/parser', 'pdfjs/core/evaluator', 'pdfjs/core/cmap',
'pdfjs/core/worker', 'pdfjs/core/network', 'pdfjs/core/type1_parser',
- 'pdfjs/core/cff_parser', 'pdfjs/display/api', 'pdfjs/display/metadata',
- 'pdfjs/display/dom_utils', 'pdfjs-web/ui_utils', 'pdfjs/core/unicode',
- 'pdfjs/core/glyphlist'],
+ 'pdfjs/core/cff_parser', 'pdfjs/core/murmurhash3', 'pdfjs/display/api',
+ 'pdfjs/display/metadata', 'pdfjs/display/dom_utils', 'pdfjs-web/ui_utils',
+ 'pdfjs/core/unicode', 'pdfjs/core/glyphlist'],
function (sharedUtil, displayGlobal, corePrimitives, coreAnnotation,
coreCrypto, coreStream, coreFonts, corePsParser, coreFunction,
coreParser, coreEvaluator, coreCMap, coreWorker, coreNetwork,
- coreType1Parser, coreCFFParser, displayAPI, displayMetadata,
- displayDOMUtils, webUIUtils, coreUnicode, coreGlyphList) {
+ coreType1Parser, coreCFFParser, coreMurmurHash3, displayAPI,
+ displayMetadata, displayDOMUtils, webUIUtils, coreUnicode,
+ coreGlyphList) {
pdfjsLibs = {
sharedUtil: sharedUtil,
@@ -75,6 +76,7 @@ function initializePDFJS(callback) {
coreNetwork: coreNetwork,
coreType1Parser: coreType1Parser,
coreCFFParser: coreCFFParser,
+ coreMurmurHash3: coreMurmurHash3,
displayAPI: displayAPI,
displayMetadata: displayMetadata,
displayDOMUtils: displayDOMUtils,
diff --git a/test/unit/murmurhash3_spec.js b/test/unit/murmurhash3_spec.js
new file mode 100644
index 000000000..69865da4c
--- /dev/null
+++ b/test/unit/murmurhash3_spec.js
@@ -0,0 +1,52 @@
+/* globals jasmine, expect, it, describe, MurmurHash3_64 */
+
+'use strict';
+
+describe('MurmurHash3_64', function() {
+ it('instantiates without seed', function() {
+ var hash = new MurmurHash3_64();
+ expect(hash).toEqual(jasmine.any(MurmurHash3_64));
+ });
+ it('instantiates with seed', function() {
+ var hash = new MurmurHash3_64(1);
+ expect(hash).toEqual(jasmine.any(MurmurHash3_64));
+ });
+
+ var hexDigestExpected = 'f61cfdbfdae0f65e';
+ var sourceText = 'test';
+ var sourceCharCodes = [116, 101, 115, 116]; // 't','e','s','t'
+ it('correctly generates a hash from a string', function() {
+ var hash = new MurmurHash3_64();
+ hash.update(sourceText);
+ expect(hash.hexdigest()).toEqual(hexDigestExpected);
+ });
+ it('correctly generates a hash from a Uint8Array', function() {
+ var hash = new MurmurHash3_64();
+ hash.update(new Uint8Array(sourceCharCodes));
+ expect(hash.hexdigest()).toEqual(hexDigestExpected);
+ });
+ it('correctly generates a hash from a Uint32Array', function() {
+ var hash = new MurmurHash3_64();
+ hash.update(new Uint32Array(sourceCharCodes));
+ expect(hash.hexdigest()).toEqual(hexDigestExpected);
+ });
+
+ it('changes the hash after update without seed', function() {
+ var hash = new MurmurHash3_64();
+ var hexdigest1, hexdigest2;
+ hash.update(sourceText);
+ hexdigest1 = hash.hexdigest();
+ hash.update(sourceText);
+ hexdigest2 = hash.hexdigest();
+ expect(hexdigest1).not.toEqual(hexdigest2);
+ });
+ it('changes the hash after update with seed', function() {
+ var hash = new MurmurHash3_64(1);
+ var hexdigest1, hexdigest2;
+ hash.update(sourceText);
+ hexdigest1 = hash.hexdigest();
+ hash.update(sourceText);
+ hexdigest2 = hash.hexdigest();
+ expect(hexdigest1).not.toEqual(hexdigest2);
+ });
+});
\ No newline at end of file
diff --git a/test/unit/unit_test.html b/test/unit/unit_test.html
index 0b7a125e5..62b207ed9 100644
--- a/test/unit/unit_test.html
+++ b/test/unit/unit_test.html
@@ -30,6 +30,7 @@
+