From b2314fa2bb2d4a9ec76c0fcd7b545c2bee84b609 Mon Sep 17 00:00:00 2001 From: Jonas Wagner Date: Sat, 31 Dec 2016 01:49:56 +0100 Subject: [PATCH] Make sure seed affects output --- test/simplex-noise-test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/simplex-noise-test.js b/test/simplex-noise-test.js index 3c97da8..fcf2a2c 100644 --- a/test/simplex-noise-test.js +++ b/test/simplex-noise-test.js @@ -55,6 +55,10 @@ describe('SimplexNoise', function() { it('should return a different value for a different input', function() { assert.notEqual(simplex.noise2D(0.1, 0.2), simplex.noise2D(0.101, 0.202)); }); + it('should return a different output with a different seed', function() { + var simplex2 = new SimplexNoise(new Alea('other seed')); + assert.notEqual(simplex.noise2D(0.1, 0.2), simplex2.noise2D(0.1, 0.2)); + }); it('should return values between -1 and 1', function() { for (var x = 0; x < 10; x++) { for (var y = 0; y < 10; y++) { @@ -76,6 +80,10 @@ describe('SimplexNoise', function() { assert.notEqual(simplex.noise3D(0.1, 0.2, 0.3), simplex.noise3D(0.101, 0.202, 0.303)); assert.notEqual(simplex.noise3D(0.1, 0.2, 0.3), simplex.noise3D(0.1, 0.2, 0.303)); }); + it('should return a different output with a different seed', function() { + var simplex2 = new SimplexNoise(new Alea('other seed')); + assert.notEqual(simplex.noise2D(0.1, 0.2, 0.3), simplex2.noise2D(0.1, 0.2, 0.3)); + }); it('should return values between -1 and 1', function() { for (var x = 0; x < 10; x++) { for (var y = 0; y < 10; y++) { @@ -97,6 +105,10 @@ describe('SimplexNoise', function() { assert.notEqual(simplex.noise4D(0.1, 0.2, 0.3, 0.4), simplex.noise4D(0.101, 0.202, 0.303, 0.404)); assert.notEqual(simplex.noise4D(0.1, 0.2, 0.3, 0.4), simplex.noise4D(0.1, 0.2, 0.3, 0.404)); }); + it('should return a different output with a different seed', function() { + var simplex2 = new SimplexNoise(new Alea('other seed')); + assert.notEqual(simplex.noise2D(0.1, 0.2, 0.3, 0.4), simplex2.noise2D(0.1, 0.2, 0.3, 0.4)); + }); it('should return values between -1 and 1', function() { for (var x = 0; x < 10; x++) { for (var y = 0; y < 10; y++) {