package ch.unibe.scg.regex;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import java.util.Collections;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

import ch.unibe.scg.regex.TransitionTable.NextState;
import ch.unibe.scg.regex.TransitionTable.TDFATransitionTable;

@SuppressWarnings("javadoc")
public final class DFATableTest {
  final int s1 = 0;
  final int s2 = 1;
  final int s3 = 2;
  final int s4 = 3;
  TDFATransitionTable table;

  // Suppress seems unavoidable.
  @SuppressWarnings("unchecked")
  @Before
  public void setUp() {
    table =
        new TDFATransitionTable(new char[] {'c', 'l'}, new char[] {'k', 'm'}, new int[] {s1, s2},
            new int[] {s3, s4}, new List[] {Collections.emptyList(), Collections.emptyList()});
  }

  @Test
  public void testTable() {
    final NextState pr = table.newStateAndInstructions(200, 'd');
    assertThat(pr, is(nullValue()));
  }

  @Test
  public void testTable2() {
    final NextState pr = table.newStateAndInstructions(s1, 'c');
    assertThat(pr.getNextState(), is(s3));

  }

  @Test
  public void testTable3() {
    final NextState pr = table.newStateAndInstructions(s1, 'k');
    assertThat(pr.getNextState(), is(s3));

  }

  @Test
  public void testTable4() {
    final NextState pr = table.newStateAndInstructions(s1, 'l');
    assertThat(pr, is(nullValue()));

  }

  @Test
  public void testTable5() {
    final NextState pr = table.newStateAndInstructions(s2, 'l');
    assertThat(pr.getNextState(), is(s4));
  }

}

@@ -385,16 +385,23 @@
 est %7B%0A  
+static 
 final in
@@ -408,24 +408,31 @@
 t s1 = 0;%0A  
+static 
 final int s2
@@ -435,24 +435,31 @@
 t s2 = 1;%0A  
+static 
 final int s3
@@ -466,16 +466,23 @@
  = 2;%0A  
+static 
 final in

Make states static.