예제 #1
0
public class Test3 {
  public static final String INPUT = Input.read("input3.txt");

  @Rule public JUnitSoftAssertions softly = new JUnitSoftAssertions();

  @Test
  public void examples1() {
    softly.assertThat(call(">", new Santa())).isEqualTo(2);
    softly.assertThat(call("^>v<", new Santa())).isEqualTo(4);
    softly.assertThat(call("^v^v^v^v^v", new Santa())).isEqualTo(2);
  }

  @Test
  public void input1() {
    assertThat(call(INPUT, new Santa())).isEqualTo(2572);
  }

  @Test
  public void examples2() {
    softly.assertThat(call("^v", new Santa(), new RoboSanta())).isEqualTo(3);
    softly.assertThat(call("^>v<", new Santa(), new RoboSanta())).isEqualTo(3);
    softly.assertThat(call("^v^v^v^v^v", new Santa(), new RoboSanta())).isEqualTo(11);
  }

  @Test
  public void input2() {
    assertThat(call(INPUT, new Santa(), new RoboSanta())).isEqualTo(2631);
  }

  private int call(String directions, Santa... santas) {
    Elf elf = new Elf();
    elf.call(directions, santas);
    return elf.received();
  }
}
예제 #2
0
 public List<Object> read(int size) {
   return proxy.read(size);
 }
예제 #3
0
 public static void main(String[] args) throws IOException {
   Input input = new Input("war_peace.txt");
   input.read();
 }