testdicegames4.java

来自「通过JAVA编写的一个小游戏,键盘打字练习」· Java 代码 · 共 81 行

JAVA
81
字号
package docAndJUnit;

import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class TestDiceGames4 {

	DiceGames diceGames;
	long exception;
	
	@Before
	public void setUp() throws Exception {
		diceGames=new DiceGames();
	}

	@After
	public void tearDown() throws Exception {
	}
	
	@Test
	public void testcountFormations1()
	{
		exception = 1;
		int[] sides={1};
		assertEquals(exception,diceGames.countFormations(sides));
	}
	
	@Test
	public void testcountFormations2()
	{
		exception = 3;
		int[] sides={2,2};
		assertEquals(exception,diceGames.countFormations(sides));
	}
	
	@Test
	public void testcountFormations3()
	{
		exception = 10;
		int[] sides={4,4};
		assertEquals(exception,diceGames.countFormations(sides));
	}
	
	@Test
	public void testcountFormations4()
	{
		exception = 9;
		int[] sides={3,4};
		assertEquals(exception,diceGames.countFormations(sides));
	}
	
	@Test
	public void testcountFormations5()
	{
		exception = 48;
		int[] sides={4,5,6};
		assertEquals(exception,diceGames.countFormations(sides));
	}
	
	@Test
	public void testcountFormations6()
	{
		exception = -1;
		int[] sides={4,5,6,0};
		assertEquals(exception,diceGames.countFormations(sides));
	}

	@Test
	public void testcountFormations7()
	{
		exception = 916312070471295267L;
		int[] sides=new int[32];
		for(int i=0;i<32;i++)
			sides[i]=32;
		
		assertEquals(exception,diceGames.countFormations(sides));
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?