Skip to content

Commit b2314fa

Browse files
committed
Make sure seed affects output
1 parent 6c8568a commit b2314fa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/simplex-noise-test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ describe('SimplexNoise', function() {
5555
it('should return a different value for a different input', function() {
5656
assert.notEqual(simplex.noise2D(0.1, 0.2), simplex.noise2D(0.101, 0.202));
5757
});
58+
it('should return a different output with a different seed', function() {
59+
var simplex2 = new SimplexNoise(new Alea('other seed'));
60+
assert.notEqual(simplex.noise2D(0.1, 0.2), simplex2.noise2D(0.1, 0.2));
61+
});
5862
it('should return values between -1 and 1', function() {
5963
for (var x = 0; x < 10; x++) {
6064
for (var y = 0; y < 10; y++) {
@@ -76,6 +80,10 @@ describe('SimplexNoise', function() {
7680
assert.notEqual(simplex.noise3D(0.1, 0.2, 0.3), simplex.noise3D(0.101, 0.202, 0.303));
7781
assert.notEqual(simplex.noise3D(0.1, 0.2, 0.3), simplex.noise3D(0.1, 0.2, 0.303));
7882
});
83+
it('should return a different output with a different seed', function() {
84+
var simplex2 = new SimplexNoise(new Alea('other seed'));
85+
assert.notEqual(simplex.noise2D(0.1, 0.2, 0.3), simplex2.noise2D(0.1, 0.2, 0.3));
86+
});
7987
it('should return values between -1 and 1', function() {
8088
for (var x = 0; x < 10; x++) {
8189
for (var y = 0; y < 10; y++) {
@@ -97,6 +105,10 @@ describe('SimplexNoise', function() {
97105
assert.notEqual(simplex.noise4D(0.1, 0.2, 0.3, 0.4), simplex.noise4D(0.101, 0.202, 0.303, 0.404));
98106
assert.notEqual(simplex.noise4D(0.1, 0.2, 0.3, 0.4), simplex.noise4D(0.1, 0.2, 0.3, 0.404));
99107
});
108+
it('should return a different output with a different seed', function() {
109+
var simplex2 = new SimplexNoise(new Alea('other seed'));
110+
assert.notEqual(simplex.noise2D(0.1, 0.2, 0.3, 0.4), simplex2.noise2D(0.1, 0.2, 0.3, 0.4));
111+
});
100112
it('should return values between -1 and 1', function() {
101113
for (var x = 0; x < 10; x++) {
102114
for (var y = 0; y < 10; y++) {

0 commit comments

Comments
 (0)