mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255
This commit is contained in:
parent
b2a5225831
commit
1a81b18b9f
12321 changed files with 544385 additions and 6 deletions
33
tests/wpt/web-platform-tests/webaudio/js/helpers.js
Normal file
33
tests/wpt/web-platform-tests/webaudio/js/helpers.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
function assert_array_approx_equals(actual, expected, epsilon, description)
|
||||
{
|
||||
assert_true(actual.length === expected.length,
|
||||
(description + ": lengths differ, expected " + expected.length + " got " + actual.length))
|
||||
|
||||
for (var i=0; i < actual.length; i++) {
|
||||
assert_approx_equals(actual[i], expected[i], epsilon, (description + ": element " + i))
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Returns an array (typed or not), of the passed array with removed trailing and ending
|
||||
zero-valued elements
|
||||
*/
|
||||
function trimEmptyElements(array) {
|
||||
var start = 0;
|
||||
var end = array.length;
|
||||
|
||||
while (start < array.length) {
|
||||
if (array[start] !== 0) {
|
||||
break;
|
||||
}
|
||||
start++;
|
||||
}
|
||||
|
||||
while (end > 0) {
|
||||
end--;
|
||||
if (array[end] !== 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return array.subarray(start, end);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue