Last active
December 20, 2015 09:18
-
-
Save swartzrock/6106334 to your computer and use it in GitHub Desktop.
Sample from Programming JavaScript Applications - Early Release from OReilly Books.
This file contains 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
var highPass = function highPass(number, cutoff) { | |
if (number >= cutoff) { | |
return true; | |
} else { | |
return false; | |
} | |
}, | |
lowPass = function lowPass(number, cutoff) { | |
if (number >= cutoff) { | |
return true; | |
} else { | |
return false; | |
} | |
}; | |
module('Filter Examples'); | |
test('highPass', function () { | |
ok(!highPass(2, 5), 'Lower values should not pass.'); | |
ok(highPass(8, 5), 'Higher values should pass.'); | |
}); | |
test('lowPass', function () { | |
ok(lowPass(2, 5), 'Lower values should pass.'); // Fails | |
ok(!lowPass(8, 5), | |
'Higher values should not pass.'); // Fails | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment