Last active
August 29, 2015 13:58
-
-
Save microbial/10371477 to your computer and use it in GitHub Desktop.
Spike-Test - Useful for test driving spikes and snippets
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
/*********TinyTest******** | |
* The test function will test if two returned values are exactly the same | |
* //Pass and Fail Examples | |
* test(square(3), 9) -> Pass: 9 === 9 | |
* test(square(3), 6) -> Fail: 9 expected but got 6 | |
**/ | |
function test(conditionToTest, expectedResult) { | |
var failMsg = 'Fail: ' + expectedResult + ' expected but got ' + conditionToTest, | |
passMsg = 'Pass: ' + expectedResult + ' === ' + conditionToTest, | |
conditionPasses = conditionToTest === expectedResult; | |
console.log(conditionPasses ? passMsg : failMsg); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Test-drive with speed. This tool has next-to-no features but allows for rapid TDD. Works well with JSBin. Just drop the function at the bottom of the page out-of-sight and write inline tests and code. Results will appear in the console pane.