blob: c2c80dade07bef04efeb2dd5fb3ebeeea3fb3778 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>A simple unit testing for audio-testing.js and testharness.js</title>
<!-- This is the required dependency for testharness + audio-testing. Note
that the including order matters because audio-testing.js depends on
testharness.js -->
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audio-testing.js"></script>
</head>
<body>
<script>
var audit = Audit.createTaskRunner();
audit.defineTask('foo', function (taskDone) {
Should('Zero', 0).beEqualTo(0);
Should('One', 1).notBeEqualTo(0);
Should('Expected SNR', 110).beGreaterThanOrEqualTo(100);
taskDone();
});
audit.defineTask('bar', function (taskDone) {
var maxError = 1e-6;
Should("Maximum error value", maxError).beLessThanOrEqualTo(1e-5);
Should('One point double zero one', 1.001).beCloseTo(1, .1);
taskDone();
});
audit.defineTask('boo', function (taskDone) {
Should('[2, 2, 2]', [2, 2, 2]).beConstantValueOf(2);
Should('[1, 2, 3]', [1, 2, 3]).beEqualToArray([1, 2, 3]);
Should('My array', [0.11, 0.19]).beCloseToArray([0.1, 0.2], 0.02);
Should('My random array', [1, 1, 3, 3, 2]).containValues([1, 3, 2]);
taskDone();
});
audit.runTasks();
</script>
</body>
</html>