diff -r 50ef27b8b7dc -r 89f13f209302 src/test/java/ru/alphatech/icfpc/cards/tests/TestDbl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/java/ru/alphatech/icfpc/cards/tests/TestDbl.java Sun Jun 19 17:53:59 2011 +0400 @@ -0,0 +1,55 @@ +package ru.alphatech.icfpc.cards.tests; + +import junit.framework.Assert; + +import org.junit.Test; + +import ru.alphatech.icfpc.cards.Dbl; +import ru.alphatech.icfpc.cards.I; +import ru.alphatech.icfpc.game.ICFPCException; +import ru.alphatech.icfpc.game.IValue; +import ru.alphatech.icfpc.game.Player; +import ru.alphatech.icfpc.game.Value; + +public class TestDbl extends Assert +{ + @Test + public void testEqualValue() + { + Player opponent = new Player(); + Player proponent = new Player(); + assertEquals(65535, ((Value)new Dbl().returnValue(new Value(32768), proponent, opponent)).getValue()); + } + + public void testBiggestValue() + { + Player opponent = new Player(); + Player proponent = new Player(); + + assertEquals(65535, ((Value)new Dbl().returnValue(new Value(35000), proponent, opponent)).getValue()); + } + + public void testValue() + { + Player opponent = new Player(); + Player proponent = new Player(); + + assertEquals(22, ((Value)new Dbl().returnValue(new Value(11), proponent, opponent)).getValue()); + } + + public void testErrorValue() + { + Player opponent = new Player(); + Player proponent = new Player(); + IValue i = new I(); + try + { + new Dbl().returnValue(i, proponent, opponent); + assertFalse(true); + } + catch (ICFPCException e) + { + assertTrue(true); + } + } +}