You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
557 B
16 lines
557 B
import QUnit from 'qunit';
|
|
import { timeRangesToArray } from '../src/ranges';
|
|
|
|
// 1%
|
|
const BANDWIDTH_TOLERANCE = 0.01;
|
|
|
|
export const timeRangesEqual = function(timeRange1, timeRange2, message) {
|
|
QUnit.assert.deepEqual(timeRangesToArray(timeRange1), timeRangesToArray(timeRange2), message);
|
|
};
|
|
|
|
export const bandwidthWithinTolerance = function(actual, expected, message) {
|
|
QUnit.assert.ok(
|
|
Math.abs(actual - expected) < (expected * BANDWIDTH_TOLERANCE),
|
|
`${message}: expected ${actual} to be within ${BANDWIDTH_TOLERANCE} of ${expected}`
|
|
);
|
|
};
|