Created
March 20, 2011 21:11
-
-
Save RobertoRodrigues/878680 to your computer and use it in GitHub Desktop.
Dojo2 de 12/03/2011 FizzBuzz alterado
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
import junit.framework.TestCase; | |
public class Dojo extends TestCase { | |
int fizzBuzz(int valor) { | |
if(valor%3==0){ | |
valor = valor/3; | |
} | |
if(valor%5==0){ | |
valor = valor/5; | |
} | |
return valor; | |
} | |
//****testes**** | |
public void teste_1() throws Exception { | |
assertEquals(1,fizzBuzz(1)); | |
} | |
public void teste_2() throws Exception { | |
assertEquals(2, fizzBuzz(2)); | |
} | |
public void teste_3() throws Exception{ | |
assertEquals(1, fizzBuzz(3)); | |
} | |
public void teste_4() throws Exception{ | |
assertEquals(4, fizzBuzz(4)); | |
} | |
public void teste_5() throws Exception { | |
assertEquals(1, fizzBuzz(5)); | |
} | |
public void teste_6() throws Exception { | |
assertEquals(2, fizzBuzz(6)); | |
} | |
public void teste_7() throws Exception{ | |
assertEquals(7, fizzBuzz(7)); | |
} | |
public void teste_9() throws Exception{ | |
assertEquals(3, fizzBuzz(9)); | |
} | |
public void teste_10() throws Exception{ | |
assertEquals(2, fizzBuzz(10)); | |
} | |
public void teste_12() throws Exception{ | |
assertEquals(4, fizzBuzz(12)); | |
} | |
public void teste_15() throws Exception{ | |
assertEquals(1, fizzBuzz(15)); | |
} | |
public void teste_30() throws Exception{ | |
assertEquals(2, fizzBuzz(30)); | |
} | |
public void teste_45() throws Exception{ | |
assertEquals(3, fizzBuzz(45)); | |
} | |
public void teste_60() throws Exception{ | |
assertEquals(4, fizzBuzz(60)); | |
} | |
public void teste_33() throws Exception{ | |
assertEquals(11, fizzBuzz(33)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment