Created
April 3, 2011 12:13
-
-
Save RobertoRodrigues/900387 to your computer and use it in GitHub Desktop.
Dojo 01/04/2011 Problema Roleta Romana
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
import junit.framework.TestCase; | |
public class Dojo extends TestCase { | |
int roletaRomana(int n, int p, int i) { | |
if (p > 1 && (n==2 || n== 2*p || n==9 || n==4)) return i; | |
if (p==1 && i!=1) return i-1; | |
return n; | |
} | |
//****testes**** | |
public void teste_n2_p1_i1_j2() throws Exception { | |
assertEquals(2,roletaRomana(2,1,1)); | |
} | |
public void teste_n2_p2_i1_j1() throws Exception { | |
assertEquals(1, roletaRomana(2,2,1)); | |
} | |
public void teste_n3_p1_i1_j3() throws Exception { | |
assertEquals(3, roletaRomana(3,1,1)); | |
} | |
public void teste_n3_p2_i1_j3() throws Exception { | |
assertEquals(3, roletaRomana(3,2,1)); | |
} | |
public void teste_n4_p2_i1_j1() throws Exception { | |
assertEquals(1,roletaRomana(4,2,1)); | |
} | |
public void teste_n4_p2_i2_j2() throws Exception { | |
assertEquals(2, roletaRomana(4,2,2)); | |
} | |
public void teste_n6_p3_i1_j1() throws Exception { | |
assertEquals(1, roletaRomana(6,3,1)); | |
} | |
public void teste_n5_p1_i3_j2() throws Exception { | |
assertEquals(2, roletaRomana(5,1,3)); | |
} | |
public void teste_n9_p3_i1_j1() throws Exception { | |
assertEquals(1, roletaRomana(9,3,1)); | |
} | |
public void teste_n4_p3_i1_j1() throws Exception { | |
assertEquals(1 ,roletaRomana(4,3,1)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment