Skip to content

Instantly share code, notes, and snippets.

@RobertoRodrigues
Created April 3, 2011 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RobertoRodrigues/900376 to your computer and use it in GitHub Desktop.
Save RobertoRodrigues/900376 to your computer and use it in GitHub Desktop.
Dojo 02/04/2011 Problema Roleta Romana
import junit.framework.TestCase;
public class Dojo extends TestCase {
//****metodo para resolver o problema****
int roletaRomana(int p, int i) {
if (p==8)
return (i+6)%p;
return (i+1)%p;
}
//****testes****
public void teste_8_3() throws Exception {
assertEquals(0,roletaRomana(8, 2));
}
public void teste_8_1() throws Exception {
assertEquals(6,roletaRomana(8, 0));
}
public void teste_8_2() throws Exception{
assertEquals(7,roletaRomana(8, 1));
}
public void teste_2_0() throws Exception{
assertEquals(1,roletaRomana(2,0));
}
public void teste_2_1() throws Exception {
assertEquals(0, roletaRomana(2, 1));
}
public void teste_3_0() throws Exception {
assertEquals(1, roletaRomana (3, 0));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment