Assert a configurable value.

@param {string} name
@param {number} val
@param {number} max
function assertRange(name, val, max) {
    assert.equal(typeof val, 'number', name + ' must be a number')
    assert(!isNaN(val), 'number', name + ' must be a number')

    if (val > max)
        throw new RangeError(name + ' must be lower than ' + max + ', but is ' + val)
    else if (val < 0)
        throw new RangeError(name + ' must be greater than or equal to zero, but is ' + val)
    else if (val % 1)
        throw new RangeError(name + ' must be an integer')
}