// Path: src/main/java/com/github/liblevenshtein/transducer/factory/PositionFactory.java
// @NoArgsConstructor
// public class PositionFactory implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Builds a dummy position.
//    * @return Dummy position.
//    */
//   public Position build() {
//     return new Position(-1, -1);
//   }
// 
//   /**
//    * Builds a position vector for the standard, Levenshtein algorihtm.
//    * @param termIndex Current index of the spelling candidate.
//    * @param numErrors Number of accumulated errors at index {@code termIndex}.
//    * @return New position vector having index {@code termIndex} and error
//    *   {@code numErrors}.
//    */
//   public Position build(final int termIndex, final int numErrors) {
//     return new Position(termIndex, numErrors);
//   }
// 
//   /**
//    * Builds a position vector for the transposition and merge-and-split,
//    * Levenshtein algorihtms.
//    * @param termIndex Current index of the spelling candidate.
//    * @param numErrors Number of accumulated errors at index {@code termIndex}.
//    * @param isSpecial Either {@code 1} or {@code 0}, depending on whether the
//    *   position is a special case (numErrors.g. a transposition position).
//    * @return New position vector having index {@code termIndex}, error
//    *   {@code numErrors}, and special marker {@code isSpecial}.
//    */
//   public Position build(final int termIndex, final int numErrors, final boolean isSpecial) {
//     if (isSpecial) {
//       return new SpecialPosition(termIndex, numErrors);
//     }
// 
//     return new Position(termIndex, numErrors);
//   }
// }
// 
// Path: src/main/java/com/github/liblevenshtein/transducer/factory/PositionTransitionFactory.java
// @Setter
// @NoArgsConstructor(access = AccessLevel.PROTECTED)
// public abstract class PositionTransitionFactory implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Builds Levenshtein states.
//    */
//   protected StateFactory stateFactory;
// 
//   /**
//    * Builds Levenshtein positions.
//    */
//   protected PositionFactory positionFactory;
// 
//   /**
//    * Builds a new position-transition function.
//    * @return New position-transition function.
//    */
//   public abstract PositionTransitionFunction build();
// 
//   /**
//    * Builds position-transition functions for standard, Levenshtein states.
//    * @author Dylon Edwards
//    * @since 2.1.0
//    */
//   public static class ForStandardPositions extends PositionTransitionFactory {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public PositionTransitionFunction build() {
//       return new StandardPositionTransitionFunction()
//         .stateFactory(stateFactory)
//         .positionFactory(positionFactory);
//     }
//   }
// 
//   /**
//    * Builds position-transition functions for transposition, Levenshtein states.
//    * @author Dylon Edwards
//    * @since 2.1.0
//    */
//   public static class ForTranspositionPositions extends PositionTransitionFactory {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public PositionTransitionFunction build() {
//       return new TranspositionPositionTransitionFunction()
//         .stateFactory(stateFactory)
//         .positionFactory(positionFactory);
//     }
//   }
// 
//   /**
//    * Builds position-transition functions for merge-and-split, Levenshtein states.
//    * @author Dylon Edwards
//    * @since 2.1.0
//    */
//   public static class ForMergeAndSplitPositions extends PositionTransitionFactory {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public PositionTransitionFunction build() {
//       return new MergeAndSplitPositionTransitionFunction()
//         .stateFactory(stateFactory)
//         .positionFactory(positionFactory);
//     }
//   }
// }
// 
// Path: src/main/java/com/github/liblevenshtein/transducer/factory/StateFactory.java
// public class StateFactory implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Builds a new, Levenshtein state with the given position vectors.
//    * @param positions Array of position vectors to link into the state.
//    * @return New state having the position vectors.
//    */
//   public State build(final Position... positions) {
//     final State state = new State();
// 
//     Position prev = null;
//     for (final Position curr : positions) {
//       state.insertAfter(prev, curr);
//       prev = curr;
//     }
// 
//     return state;
//   }
// }
// 
// Path: src/test/java/com/github/liblevenshtein/assertion/StateTransitionFunctionAssertions.java
// public static StateTransitionFunctionAssertions assertThat(
//     final StateTransitionFunction actual) {
//   return new StateTransitionFunctionAssertions(actual);
// }


import java.util.Arrays;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.github.liblevenshtein.transducer.factory.PositionFactory;
import com.github.liblevenshtein.transducer.factory.PositionTransitionFactory;
import com.github.liblevenshtein.transducer.factory.StateFactory;
import static com.github.liblevenshtein.assertion.StateTransitionFunctionAssertions.assertThat;
package com.github.liblevenshtein.transducer;





/**
 * These tests were taken from the transition tables on page 29 of "Fast String
 * Correction with Levenshtein Automata".
 */
public class StateTransitionFunctionTest {

  private static final int N = 1;

  private static final int W = 5;

  private final PositionFactory positionFactory = new PositionFactory();

// Path: src/main/java/com/github/liblevenshtein/transducer/factory/PositionFactory.java
// @NoArgsConstructor
// public class PositionFactory implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Builds a dummy position.
//    * @return Dummy position.
//    */
//   public Position build() {
//     return new Position(-1, -1);
//   }
// 
//   /**
//    * Builds a position vector for the standard, Levenshtein algorihtm.
//    * @param termIndex Current index of the spelling candidate.
//    * @param numErrors Number of accumulated errors at index {@code termIndex}.
//    * @return New position vector having index {@code termIndex} and error
//    *   {@code numErrors}.
//    */
//   public Position build(final int termIndex, final int numErrors) {
//     return new Position(termIndex, numErrors);
//   }
// 
//   /**
//    * Builds a position vector for the transposition and merge-and-split,
//    * Levenshtein algorihtms.
//    * @param termIndex Current index of the spelling candidate.
//    * @param numErrors Number of accumulated errors at index {@code termIndex}.
//    * @param isSpecial Either {@code 1} or {@code 0}, depending on whether the
//    *   position is a special case (numErrors.g. a transposition position).
//    * @return New position vector having index {@code termIndex}, error
//    *   {@code numErrors}, and special marker {@code isSpecial}.
//    */
//   public Position build(final int termIndex, final int numErrors, final boolean isSpecial) {
//     if (isSpecial) {
//       return new SpecialPosition(termIndex, numErrors);
//     }
// 
//     return new Position(termIndex, numErrors);
//   }
// }
// 
// Path: src/main/java/com/github/liblevenshtein/transducer/factory/PositionTransitionFactory.java
// @Setter
// @NoArgsConstructor(access = AccessLevel.PROTECTED)
// public abstract class PositionTransitionFactory implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Builds Levenshtein states.
//    */
//   protected StateFactory stateFactory;
// 
//   /**
//    * Builds Levenshtein positions.
//    */
//   protected PositionFactory positionFactory;
// 
//   /**
//    * Builds a new position-transition function.
//    * @return New position-transition function.
//    */
//   public abstract PositionTransitionFunction build();
// 
//   /**
//    * Builds position-transition functions for standard, Levenshtein states.
//    * @author Dylon Edwards
//    * @since 2.1.0
//    */
//   public static class ForStandardPositions extends PositionTransitionFactory {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public PositionTransitionFunction build() {
//       return new StandardPositionTransitionFunction()
//         .stateFactory(stateFactory)
//         .positionFactory(positionFactory);
//     }
//   }
// 
//   /**
//    * Builds position-transition functions for transposition, Levenshtein states.
//    * @author Dylon Edwards
//    * @since 2.1.0
//    */
//   public static class ForTranspositionPositions extends PositionTransitionFactory {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public PositionTransitionFunction build() {
//       return new TranspositionPositionTransitionFunction()
//         .stateFactory(stateFactory)
//         .positionFactory(positionFactory);
//     }
//   }
// 
//   /**
//    * Builds position-transition functions for merge-and-split, Levenshtein states.
//    * @author Dylon Edwards
//    * @since 2.1.0
//    */
//   public static class ForMergeAndSplitPositions extends PositionTransitionFactory {
// 
//     private static final long serialVersionUID = 1L;
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public PositionTransitionFunction build() {
//       return new MergeAndSplitPositionTransitionFunction()
//         .stateFactory(stateFactory)
//         .positionFactory(positionFactory);
//     }
//   }
// }
// 
// Path: src/main/java/com/github/liblevenshtein/transducer/factory/StateFactory.java
// public class StateFactory implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Builds a new, Levenshtein state with the given position vectors.
//    * @param positions Array of position vectors to link into the state.
//    * @return New state having the position vectors.
//    */
//   public State build(final Position... positions) {
//     final State state = new State();
// 
//     Position prev = null;
//     for (final Position curr : positions) {
//       state.insertAfter(prev, curr);
//       prev = curr;
//     }
// 
//     return state;
//   }
// }
// 
// Path: src/test/java/com/github/liblevenshtein/assertion/StateTransitionFunctionAssertions.java
// public static StateTransitionFunctionAssertions assertThat(
//     final StateTransitionFunction actual) {
//   return new StateTransitionFunctionAssertions(actual);
// }


// Path: src/test/java/com/github/liblevenshtein/transducer/StateTransitionFunctionTest.java
import java.util.Arrays;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.github.liblevenshtein.transducer.factory.PositionFactory;
import com.github.liblevenshtein.transducer.factory.PositionTransitionFactory;
import com.github.liblevenshtein.transducer.factory.StateFactory;
import static com.github.liblevenshtein.assertion.StateTransitionFunctionAssertions.assertThat;

package com.github.liblevenshtein.transducer;





/**
 * These tests were taken from the transition tables on page 29 of "Fast String
 * Correction with Levenshtein Automata".
 */
public class StateTransitionFunctionTest {

  private static final int N = 1;

  private static final int W = 5;

  private final PositionFactory positionFactory = new PositionFactory();

  private final StateFactory stateFactory = new StateFactory();