Skip to content

Commit

Permalink
Upgrade dev deps
Browse files Browse the repository at this point in the history
  • Loading branch information
milcktoast committed Oct 17, 2019
1 parent 65b0545 commit dfb0fe3
Show file tree
Hide file tree
Showing 19 changed files with 191 additions and 171 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
sudo: false
node_js:
- "6.1"
- "8"
before_script:
- npm install -g grunt-cli
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = function (grunt) {
rollup: {
src: {
options: {
moduleName: 'Particulate',
name: 'Particulate',
format: 'umd'
},
src: config.src + 'index.js',
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
"url": "http://jayweeks.com"
},
"devDependencies": {
"grunt": "~1.0.1",
"grunt": "~1.0.4",
"grunt-banner": "^0.6.0",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-jshint": "^1.0.0",
"grunt-contrib-uglify": "^1.0.1",
"grunt-contrib-watch": "^1.0.0",
"grunt-contrib-connect": "^2.1.0",
"grunt-contrib-jshint": "^2.1.0",
"grunt-contrib-uglify": "^4.0.1",
"grunt-contrib-watch": "^1.1.0",
"grunt-contrib-yuidoc": "^1.0.0",
"grunt-coveralls": "^1.0.1",
"grunt-coveralls": "^2.0.0",
"grunt-neuter": "~0.6.0",
"grunt-qunit-istanbul": "^0.6.0",
"grunt-rollup": "^0.7.1",
"grunt-qunit-istanbul": "^1.1.0",
"grunt-rollup": "^10.0.0",
"jit-grunt": "^0.10.0",
"qunit-theme-ninja": "^1.1.0",
"qunitjs": "^1.23.1",
"qunit-theme-ninja": "^2.0.0",
"qunitjs": "^2.4.1",
"three": "^0.69.0"
},
"scripts": {
Expand Down
30 changes: 21 additions & 9 deletions test/assert/close-enough.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
Test.assert.close = assert_close
function assert_close(actual, expected, maxDifference, message) {
QUnit.assert.close = function (actual, expected, maxDifference, message) {
var passes = (actual === expected) || Math.abs(actual - expected) <= maxDifference
QUnit.push(passes, actual, expected, message)
this.pushResult({
result: passes,
actual: actual,
expected: expected,
message: message
})
}

Test.assert.closeArray = assert_closeMany
function assert_closeMany(actual, expected, maxDifference, message) {
QUnit.assert.closeArray = function (actual, expected, maxDifference, message) {
var passes
for (var i = 0, il = actual.length; i < il; i ++) {
passes = (actual[i] === expected[i]) || Math.abs(actual[i] - expected[i]) <= maxDifference
if (!passes) { break; }
}
QUnit.push(passes, actual, expected, message)
this.pushResult({
result: passes,
actual: actual,
expected: expected,
message: message
})
}

Test.assert.notClose = assert_notClose
function assert_notClose(actual, expected, minDifference, message) {
QUnit.push(Math.abs(actual - expected) > minDifference, actual, expected, message)
QUnit.assert.notClose = function (actual, expected, minDifference, message) {
this.pushResult({
result: Math.abs(actual - expected) > minDifference,
actual: actual,
expected: expected,
message: message
})
}
10 changes: 7 additions & 3 deletions test/assert/equal-array.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Test.assert.equalArray = assert_equalArray
function assert_equalArray(actual, expected, message) {
QUnit.assert.equalArray = function (actual, expected, message) {
var isEqual = true

for (var i = 0, il = expected.length; i < il; i ++) {
Expand All @@ -9,5 +8,10 @@ function assert_equalArray(actual, expected, message) {
}
}

QUnit.push(isEqual, actual, expected, message)
this.pushResult({
result: isEqual,
actual: actual,
expected: expected,
message: message
})
}
10 changes: 7 additions & 3 deletions test/assert/range.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Test.assert.range = assert_range
function assert_range(actual, min, max, message) {
QUnit.assert.range = function (actual, min, max, message) {
var passes = actual >= min && actual <= max
var expected = [min, max]
QUnit.push(passes, actual, expected, message)
this.pushResult({
result: passes,
actual: actual,
expected: expected,
message: message
})
}
26 changes: 13 additions & 13 deletions test/constraints/AngleConstraint.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
module('Constraint.Angle')
QUnit.module('Constraint.Angle')

var AngleConstraint = Particulate.AngleConstraint
var PI = Math.PI

// Creation
// --------

test('Creation', function () {
QUnit.test('Creation', function (assert) {
var min = 2, max = 3
var a = 1, b = 3, c = 2
var indices = [0, 1, 2, 3, 4, 5]
var fromArgs = AngleConstraint.create([min, max], a, b, c)
var fromArray = AngleConstraint.create([min, max], indices)

Test.assert.equalArray(fromArgs.indices, [a, b, c],
assert.equalArray(fromArgs.indices, [a, b, c],
'Should create indices from int arguments.')
Test.assert.equalArray(fromArray.indices, indices,
assert.equalArray(fromArray.indices, indices,
'Should create indices from int array.')
})

// Application
// -----------

function testAtAngle(angle, makePerturbed) {
function testAtAngle(assert, angle, makePerturbed) {
var system = Particulate.ParticleSystem.create(3, 50)
var single = AngleConstraint.create(angle, 0, 1, 2)

Expand All @@ -38,20 +38,20 @@ function testAtAngle(angle, makePerturbed) {
'Should constrain particles to ' + approxAngle + ' radians.' :
'Should constrain coincident particles to ' + approxAngle + ' radians.'

Test.assert.close(system.getAngle(0, 1, 2), angle, 0.1, message)
assert.close(system.getAngle(0, 1, 2), angle, 0.1, message)
}

test('Application of angle', function () {
QUnit.test('Application of angle', function (assert) {
var angles = 10
var angle
for (var i = 0; i < angles; i ++) {
angle = PI * i / (angles - 1)
testAtAngle(angle, true)
testAtAngle(angle, false)
testAtAngle(assert, angle, true)
testAtAngle(assert, angle, false)
}
})

test('Application of angle range', function () {
QUnit.test('Application of angle range', function (assert) {
var system = Particulate.ParticleSystem.create(9, 50)
var noMin = AngleConstraint.create([0, PI * 0.25], 0, 1, 2)
var noMax = AngleConstraint.create([PI * 0.25, Infinity], 3, 4, 5)
Expand All @@ -70,10 +70,10 @@ test('Application of angle range', function () {
system.addConstraint(range)
system.tick(1)

Test.assert.range(system.getAngle(0, 1, 2), noMin._min - tolerance, noMin._max + tolerance,
assert.range(system.getAngle(0, 1, 2), noMin._min - tolerance, noMin._max + tolerance,
'Should constrain particles if angle is greater than upper bound of range.')
Test.assert.range(system.getAngle(3, 4, 5), noMax._min - tolerance, noMax._max + tolerance,
assert.range(system.getAngle(3, 4, 5), noMax._min - tolerance, noMax._max + tolerance,
'Should constrain particles if angle is less than lower bound of range.')
Test.assert.range(system.getAngle(6, 7, 8), range._min - tolerance, range._max + tolerance,
assert.range(system.getAngle(6, 7, 8), range._min - tolerance, range._max + tolerance,
'Should not affect particles within range tolerance.')
})
14 changes: 7 additions & 7 deletions test/constraints/AxisConstraint.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module('Constraint.Axis')
QUnit.module('Constraint.Axis')

var ParticleSystem = Particulate.ParticleSystem
var AxisConstraint = Particulate.AxisConstraint
var Vec3 = Particulate.Vec3

test('Creation', function () {
QUnit.test('Creation', function (assert) {
var start = 0, end = 1
var a = 1
var indices = [0, 1, 2]
var fromArgs = AxisConstraint.create(start, end, a)
var fromArray = AxisConstraint.create(start, end, indices)

Test.assert.equalArray(fromArgs.indices, [start, end, a],
assert.equalArray(fromArgs.indices, [start, end, a],
'Should create indices from int arguments.')
Test.assert.equalArray(fromArray.indices, [start, end].concat(indices),
assert.equalArray(fromArray.indices, [start, end].concat(indices),
'Should create indices from int array.')
})

test('Application', function () {
QUnit.test('Application', function (assert) {
var system = ParticleSystem.create(6, 10)
var start = 0, end = 1
var single = AxisConstraint.create(start, end, 2)
Expand All @@ -37,8 +37,8 @@ test('Application', function () {
system.addConstraint(many)
system.tick(1)

Test.assert.close(getY(2), posY, 0.1,
assert.close(getY(2), posY, 0.1,
'Should constrain single particle to axis.')
Test.assert.closeArray([getY(3), getY(4), getY(5)], [posY, posY, posY], 0.1,
assert.closeArray([getY(3), getY(4), getY(5)], [posY, posY, posY], 0.1,
'Should constrain multiple particles to axis.')
})
18 changes: 9 additions & 9 deletions test/constraints/BoundingPlaneConstraint.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module('Constraint.BoundingPlane')
QUnit.module('Constraint.BoundingPlane')

var ParticleSystem = Particulate.ParticleSystem
var BoundingPlaneConstraint = Particulate.BoundingPlaneConstraint
var Vec3 = Particulate.Vec3

test('Creation', function () {
QUnit.test('Creation', function (assert) {
var origin = [0, 1, 2]
var normal = [0, 1, 0]
var constraint = BoundingPlaneConstraint.create(origin, normal)

Test.assert.equalArray(constraint.bufferVec3, [].concat(origin, normal),
assert.equalArray(constraint.bufferVec3, [].concat(origin, normal),
'Should initialize origin and normal vec3s.')
})

test('Application', function () {
QUnit.test('Application', function (assert) {
var system = ParticleSystem.create(2, 10)
var origin = [5, 6, 7]
var normal = [0, 0, 1]
Expand All @@ -25,13 +25,13 @@ test('Application', function () {
system.addConstraint(constraint)
system.tick(1)

Test.assert.range(system.getPosition(0, pos)[2], origin[2], Infinity,
assert.range(system.getPosition(0, pos)[2], origin[2], Infinity,
'Should constrain particles behind plane.')
Test.assert.equalArray(system.getPosition(1, pos), [10, 10, 10],
assert.equalArray(system.getPosition(1, pos), [10, 10, 10],
'Should not affect particles in front of plane.')
})

test('Application with distance influence', function () {
QUnit.test('Application with distance influence', function (assert) {
var system = ParticleSystem.create(2, 10)
var origin = [5, 6, 7]
var normal = [0, 0, 1]
Expand All @@ -44,8 +44,8 @@ test('Application with distance influence', function () {
system.addConstraint(constraint)
system.tick(1)

Test.assert.close(system.getPosition(0, pos)[2], origin[2], 0.1,
assert.close(system.getPosition(0, pos)[2], origin[2], 0.1,
'Should constrain particles behind plane.')
Test.assert.close(system.getPosition(1, pos)[2], origin[2], 0.1,
assert.close(system.getPosition(1, pos)[2], origin[2], 0.1,
'Should constrain particles in front of plane within distance influence.')
})
14 changes: 7 additions & 7 deletions test/constraints/BoxConstraint.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
module('Constraint.Box')
QUnit.module('Constraint.Box')

var BoxConstraint = Particulate.BoxConstraint
var Vec3 = Particulate.Vec3

// Creation
// --------

test('Creation', function () {
QUnit.test('Creation', function (assert) {
var min = [-10, -10, -10]
var max = [ 10, 10, 10]
var constraint = BoxConstraint.create(min, max)

Test.assert.equalArray(constraint.bufferVec3, [].concat(min, max),
assert.equalArray(constraint.bufferVec3, [].concat(min, max),
'Should initialize bounds from min and max vec3s.')
})

// Application
// -----------

test('Application', function () {
QUnit.test('Application', function (assert) {
var system = Particulate.ParticleSystem.create(4, 10)
var min = [-1, -2, -3]
var max = [ 4, 5, 6]
Expand All @@ -30,7 +30,7 @@ test('Application', function () {

var pos0 = system.getPosition(0, Vec3.create())

Test.assert.range(pos0[0], min[0], max[0], 'Should bound x position.')
Test.assert.range(pos0[1], min[1], max[1], 'Should bound y position.')
Test.assert.range(pos0[2], min[2], max[2], 'Should bound z position.')
assert.range(pos0[0], min[0], max[0], 'Should bound x position.')
assert.range(pos0[1], min[1], max[1], 'Should bound y position.')
assert.range(pos0[2], min[2], max[2], 'Should bound z position.')
})
18 changes: 9 additions & 9 deletions test/constraints/Constraint.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
module('Constraint')
QUnit.module('Constraint')

var Constraint = Particulate.Constraint

test('Creation', function () {
QUnit.test('Creation', function (assert) {
var constraint = Constraint.create(3, 1)

equal(constraint.indices.length, 3,
assert.equal(constraint.indices.length, 3,
'Should initialize indices as int array.')
})

test('Setting indices', function () {
QUnit.test('Setting indices', function (assert) {
var a = 1, b = 4
var indices = [a, b]
var constraint = Constraint.create(2, 1)

constraint.setIndices(a, b)
Test.assert.equalArray(constraint.indices, indices,
assert.equalArray(constraint.indices, indices,
'Should set indices from integers.')

constraint.setIndices(indices)
Test.assert.equalArray(constraint.indices, indices,
assert.equalArray(constraint.indices, indices,
'Should set indices from array.')
})

test('Setting indices with index offset', function () {
QUnit.test('Setting indices with index offset', function (assert) {
var a = 1, b = 4
var size = 2, itemSize = 1, offset = 3
var indices = [a, b]
var expectedIndices = [0, 0, 0, a, b]
var constraint = Constraint.create(size, itemSize, offset)

constraint.setIndices(a, b)
Test.assert.equalArray(constraint.indices, expectedIndices,
assert.equalArray(constraint.indices, expectedIndices,
'Should set indices from integers.')

constraint.setIndices(indices)
Test.assert.equalArray(constraint.indices, expectedIndices,
assert.equalArray(constraint.indices, expectedIndices,
'Should set indices from array.')
})
Loading

0 comments on commit dfb0fe3

Please sign in to comment.