Last active
February 7, 2017 06:48
-
-
Save cmstead/418dd9844292709cdfb173a8754141c8 to your computer and use it in GitHub Desktop.
Extended test runner for UI tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (testRunner) { | |
'use strict'; | |
function logAndTestUi(sample, expectedMean, expectedStandardDeviation) { | |
var message = 'Testing -- ' + | |
'sample: ' + JSON.stringify(sample) + '; ' + | |
'expected mean: ' + expectedMean + '; ' + | |
'expected standard deviation: ' + expectedStandardDeviation; | |
console.log(message); | |
return testRunner.testUi(sample, expectedMean, expectedStandardDeviation); | |
} | |
function testUiCases() { | |
var result = null; | |
// Failing cases | |
result = logAndTestUi([], NaN, NaN); | |
result = logAndTestUi([parseFloat('a'), parseFloat('b')], NaN, NaN); | |
// Passing cases | |
result = logAndTestUi([1, 2, 1, 2], 1.5, 0.5); | |
result = logAndTestUi([1, 2, 3, 1, 2, 3], 2, 0.816496580927726); | |
return result; | |
} | |
testRunner.testUiCases = testUiCases; | |
})(testRunner); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment