src/test/java/ru/alphatech/icfpc/cards/tests/TestDbl.java
changeset 97 89f13f209302
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/test/java/ru/alphatech/icfpc/cards/tests/TestDbl.java	Sun Jun 19 17:53:59 2011 +0400
     1.3 @@ -0,0 +1,55 @@
     1.4 +package ru.alphatech.icfpc.cards.tests;
     1.5 +
     1.6 +import junit.framework.Assert;
     1.7 +
     1.8 +import org.junit.Test;
     1.9 +
    1.10 +import ru.alphatech.icfpc.cards.Dbl;
    1.11 +import ru.alphatech.icfpc.cards.I;
    1.12 +import ru.alphatech.icfpc.game.ICFPCException;
    1.13 +import ru.alphatech.icfpc.game.IValue;
    1.14 +import ru.alphatech.icfpc.game.Player;
    1.15 +import ru.alphatech.icfpc.game.Value;
    1.16 +
    1.17 +public class TestDbl extends Assert
    1.18 +{
    1.19 +	@Test
    1.20 +	public void testEqualValue()
    1.21 +	{
    1.22 +		Player opponent = new Player();
    1.23 +		Player proponent = new Player();
    1.24 +		assertEquals(65535, ((Value)new Dbl().returnValue(new Value(32768), proponent, opponent)).getValue());
    1.25 +	}
    1.26 +
    1.27 +	public void testBiggestValue()
    1.28 +	{
    1.29 +		Player opponent = new Player();
    1.30 +		Player proponent = new Player();
    1.31 +
    1.32 +		assertEquals(65535, ((Value)new Dbl().returnValue(new Value(35000), proponent, opponent)).getValue());
    1.33 +	}
    1.34 +
    1.35 +	public void testValue()
    1.36 +	{
    1.37 +		Player opponent = new Player();
    1.38 +		Player proponent = new Player();
    1.39 +
    1.40 +		assertEquals(22, ((Value)new Dbl().returnValue(new Value(11), proponent, opponent)).getValue());
    1.41 +	}
    1.42 +
    1.43 +	public void testErrorValue()
    1.44 +	{
    1.45 +		Player opponent = new Player();
    1.46 +		Player proponent = new Player();
    1.47 +		IValue i = new I();
    1.48 +		try
    1.49 +		{
    1.50 +			new Dbl().returnValue(i, proponent, opponent);
    1.51 +			assertFalse(true);
    1.52 +		}
    1.53 +		catch (ICFPCException e)
    1.54 +		{
    1.55 +			assertTrue(true);
    1.56 +		}
    1.57 +	}
    1.58 +}