package net.ciklum.icfpc11.controller.ai; import junit.framework.TestCase import net.ciklum.icfpc11.parser.Command import static net.ciklum.icfpc11.domain.Card.* import static net.ciklum.icfpc11.parser.Application.LEFT import static net.ciklum.icfpc11.parser.Application.RIGHT /** * blabla * @author vic */ public class StaticStrategyTest extends TestCase { void test_empty() { StaticStrategy ss = new StaticStrategy([]) assertTrue ss.isComplete() try { ss.getNextCommand() fail 'cant get next command after strategy end' } catch (IndexOutOfBoundsException ) { } } void test_some() { List commands = [ new Command(RIGHT, 77, zero), // 0 new Command(LEFT, 77, get), // 255 (from oth cell) new Command(LEFT, 77, dec) // dec the 0th (255-255) cell ] StaticStrategy ss = new StaticStrategy(commands) assertFalse ss.isComplete() assertEquals zero, ss.getNextCommand().card assertFalse ss.isComplete() assertEquals get, ss.getNextCommand().card assertFalse ss.isComplete() assertEquals dec, ss.getNextCommand().card assertTrue ss.isComplete() try { ss.getNextCommand() fail 'cant get next command after strategy end' } catch (IndexOutOfBoundsException ) { } } }