// Path: src/main/java/es/cnio/bioinfo/bicycle/gatk/ListerFilter.java
// protected static class MDTagIterator implements Iterator<MDTagOperator> {
// 	static final Pattern mdPat = Pattern.compile("\\G(?:([0-9]+)|([ACTGNactgn])|(\\^[ACTGNactgn]+))");
// 
// 	private final boolean reverse;
// 	private List<MDTagOperation> mdOperations;
// 	private int currentMDOperationsPos;
// 
// 	private int repetitionsOfCurrentOperation = 0;
// 	private MDTagOperator currentOperator = null;
// 
// 	private List<MDTagOperation> decodeMDTag(String mdString) {
// 		Matcher matcher = mdPat.matcher(mdString);
// 
// 		ArrayList result = new ArrayList<>();
// 		while (matcher.find()) {
// 			if (matcher.group(1) != null) {
// 				// match
// 				int length = Integer.parseInt(matcher.group(1));
// 				if (length > 0) {
// 					result.add(new SequenceMatchOperation(Integer.parseInt(matcher.group(1))));
// 				}
// 			} else if (matcher.group(2) != null) {
// 				// variant
// 				result.add(new SequenceVariantOperation(matcher.group(2).charAt(0)));
// 			} else if (matcher.group(3) != null) {
// 				// deletion
// 				result.add(new DeletionOperation(matcher.group(3).substring(1)));
// 			}
// 		}
// 
// 		return result;
// 	}
// 
// 	public MDTagIterator(String mdString, boolean reverse) {
// 		this.mdOperations = decodeMDTag(mdString);
// 		this.reverse = reverse;
// 		this.currentMDOperationsPos = this.reverse ? mdOperations.size() : -1;
// 		this.advanceMDOperation();
// 	}
// 
// 	@Override
// 	public boolean hasNext() {
// 		return repetitionsOfCurrentOperation > 0
// 				|| (this.currentMDOperationsPos >= 0 && this.currentMDOperationsPos < this.mdOperations.size());
// 	}
// 
// 	@Override
// 	public MDTagOperator next() {
// 
// 		MDTagOperator result = this.currentOperator;
// 		this.repetitionsOfCurrentOperation--;
// 		if (repetitionsOfCurrentOperation == 0 && (this.currentMDOperationsPos >= 0 && this
// 				.currentMDOperationsPos < this.mdOperations.size())) {
// 			advanceMDOperation();
// 		}
// 
// 		return result;
// 	}
// 
// 	private void advanceMDOperation() {
// 		this.currentMDOperationsPos = this.currentMDOperationsPos + (this.reverse ? -1 : 1);
// 		if (this.currentMDOperationsPos >= 0 && this.currentMDOperationsPos < this.mdOperations.size()) {
// 			MDTagOperation element = this.mdOperations.get(this.currentMDOperationsPos);
// 			this.repetitionsOfCurrentOperation = element.getLength();
// 			this.currentOperator = element.getOperator();
// 		}
// 	}
// }
// 
// Path: src/main/java/es/cnio/bioinfo/bicycle/gatk/ListerFilter.java
// protected enum MDTagOperator {
// 	DELETION, SEQUENCE_MATCH, VARIANT
// }


import static junit.framework.Assert.assertEquals;
import org.junit.Test;
import es.cnio.bioinfo.bicycle.gatk.ListerFilter.MDTagIterator;
import es.cnio.bioinfo.bicycle.gatk.ListerFilter.MDTagOperator;
import net.sf.samtools.CigarOperator;
package es.cnio.bioinfo.bicycle.gatk;





public class MDIteratorTest {

	@Test
// Path: src/main/java/es/cnio/bioinfo/bicycle/gatk/ListerFilter.java
// protected static class MDTagIterator implements Iterator<MDTagOperator> {
// 	static final Pattern mdPat = Pattern.compile("\\G(?:([0-9]+)|([ACTGNactgn])|(\\^[ACTGNactgn]+))");
// 
// 	private final boolean reverse;
// 	private List<MDTagOperation> mdOperations;
// 	private int currentMDOperationsPos;
// 
// 	private int repetitionsOfCurrentOperation = 0;
// 	private MDTagOperator currentOperator = null;
// 
// 	private List<MDTagOperation> decodeMDTag(String mdString) {
// 		Matcher matcher = mdPat.matcher(mdString);
// 
// 		ArrayList result = new ArrayList<>();
// 		while (matcher.find()) {
// 			if (matcher.group(1) != null) {
// 				// match
// 				int length = Integer.parseInt(matcher.group(1));
// 				if (length > 0) {
// 					result.add(new SequenceMatchOperation(Integer.parseInt(matcher.group(1))));
// 				}
// 			} else if (matcher.group(2) != null) {
// 				// variant
// 				result.add(new SequenceVariantOperation(matcher.group(2).charAt(0)));
// 			} else if (matcher.group(3) != null) {
// 				// deletion
// 				result.add(new DeletionOperation(matcher.group(3).substring(1)));
// 			}
// 		}
// 
// 		return result;
// 	}
// 
// 	public MDTagIterator(String mdString, boolean reverse) {
// 		this.mdOperations = decodeMDTag(mdString);
// 		this.reverse = reverse;
// 		this.currentMDOperationsPos = this.reverse ? mdOperations.size() : -1;
// 		this.advanceMDOperation();
// 	}
// 
// 	@Override
// 	public boolean hasNext() {
// 		return repetitionsOfCurrentOperation > 0
// 				|| (this.currentMDOperationsPos >= 0 && this.currentMDOperationsPos < this.mdOperations.size());
// 	}
// 
// 	@Override
// 	public MDTagOperator next() {
// 
// 		MDTagOperator result = this.currentOperator;
// 		this.repetitionsOfCurrentOperation--;
// 		if (repetitionsOfCurrentOperation == 0 && (this.currentMDOperationsPos >= 0 && this
// 				.currentMDOperationsPos < this.mdOperations.size())) {
// 			advanceMDOperation();
// 		}
// 
// 		return result;
// 	}
// 
// 	private void advanceMDOperation() {
// 		this.currentMDOperationsPos = this.currentMDOperationsPos + (this.reverse ? -1 : 1);
// 		if (this.currentMDOperationsPos >= 0 && this.currentMDOperationsPos < this.mdOperations.size()) {
// 			MDTagOperation element = this.mdOperations.get(this.currentMDOperationsPos);
// 			this.repetitionsOfCurrentOperation = element.getLength();
// 			this.currentOperator = element.getOperator();
// 		}
// 	}
// }
// 
// Path: src/main/java/es/cnio/bioinfo/bicycle/gatk/ListerFilter.java
// protected enum MDTagOperator {
// 	DELETION, SEQUENCE_MATCH, VARIANT
// }


// Path: src/test/java/es/cnio/bioinfo/bicycle/gatk/MDIteratorTest.java
import static junit.framework.Assert.assertEquals;
import org.junit.Test;
import es.cnio.bioinfo.bicycle.gatk.ListerFilter.MDTagIterator;
import es.cnio.bioinfo.bicycle.gatk.ListerFilter.MDTagOperator;
import net.sf.samtools.CigarOperator;

package es.cnio.bioinfo.bicycle.gatk;





public class MDIteratorTest {

	@Test
	public void testPerfectMatch() {