Created
November 22, 2012 20:02
-
-
Save Chavao/4132723 to your computer and use it in GitHub Desktop.
Teste em JavaScript
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 assertEquals(x, y) { | |
if(x == y) { | |
console.log('.'); | |
} else { | |
console.log("Failed asserting that "+x+" matches expected '"+y+"'"); | |
} | |
} | |
function testFuncao() { | |
assertEquals(funcao(0), 15); | |
assertEquals(funcao(10), 30); | |
assertEquals(funcao(20), 45); | |
assertEquals(funcao(30), 60); | |
assertEquals(funcao(40), 75); | |
assertEquals(funcao(50), 90); | |
} | |
function funcao(x) { | |
return 15 + (1.5 * x); | |
} | |
testFuncao(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment