Skip to content

Instantly share code, notes, and snippets.

@Chavao
Created November 22, 2012 20:02
Show Gist options
  • Save Chavao/4132723 to your computer and use it in GitHub Desktop.
Save Chavao/4132723 to your computer and use it in GitHub Desktop.
Teste em JavaScript
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