Skip to content

Instantly share code, notes, and snippets.

@WizardOfArc
Last active August 28, 2019 10:24
Show Gist options
  • Select an option

  • Save WizardOfArc/f64ab1f655c9d8c1f5029911f192a4e2 to your computer and use it in GitHub Desktop.

Select an option

Save WizardOfArc/f64ab1f655c9d8c1f5029911f192a4e2 to your computer and use it in GitHub Desktop.
function tester(func, input, expected){
let actual = func(...input);
if ( actual === expected ){
console.log( "PASS" );
} else {
console.log( "FAIL: actual [" + actual + "] did not equal expected [" + expected + "]");
}
}
function batchTester(func, testCases){
testCases.forEach( tc => tester(func, tc.input, tc.expected) );
}
@WizardOfArc
Copy link
Copy Markdown
Author

func here is the function you are testing, and it can be any arity as long as your testCase.input can "spread" to the same number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment