// this doesn't work -- but I'm not sure it should
//        tests.add(new Object[]{"2M3I4M", 2, 1, "3I"});
@DataProvider(name = "TrimCigarData")
    public Object[][] makeTrimCigarData() {
        List<Object[]> tests = new ArrayList<>();
        for ( final CigarOperator op : Arrays.asList(CigarOperator.D, CigarOperator.EQ, CigarOperator.X, CigarOperator.M) ) {
            for ( int myLength = 1; myLength < 6; myLength++ ) {
                for ( int start = 0; start < myLength - 1; start++ ) {
                    for ( int end = start; end < myLength; end++ ) {
                        final int length = end - start + 1;
                        final List<CigarOperator> padOps = Arrays.asList(CigarOperator.D, CigarOperator.M);
                        for ( final CigarOperator padOp: padOps) {
                            for ( int leftPad = 0; leftPad < 2; leftPad++ ) {
                                for ( int rightPad = 0; rightPad < 2; rightPad++ ) {
                                    tests.add(new Object[]{
                                            (leftPad > 0 ? leftPad + padOp.toString() : "") + myLength + op.toString() + (rightPad > 0 ? rightPad + padOp.toString() : ""),
                                            start + leftPad,
                                            end + leftPad,
                                            length + op.toString()});
                                }
                            }
                        }
                    }
                }
            }
        }
        for ( final int leftPad : Arrays.asList(0, 1, 2, 5) ) {
            for ( final int rightPad : Arrays.asList(0, 1, 2, 5) ) {
                final int length = leftPad + rightPad;
                if ( length > 0 ) {
                    for ( final int insSize : Arrays.asList(1, 10) ) {
                        for ( int start = 0; start <= leftPad; start++ ) {
                            for ( int stop = leftPad; stop < length; stop++ ) {
                                final int leftPadRemaining = leftPad - start;
                                final int rightPadRemaining = stop - leftPad + 1;
                                final String insC = insSize + "I";
                                tests.add(new Object[]{
                                        leftPad + "M" + insC + rightPad + "M",
                                        start,
                                        stop,
                                        (leftPadRemaining > 0 ? leftPadRemaining + "M" : "") + insC + (rightPadRemaining > 0 ? rightPadRemaining + "M" : "")
                                });
                            }
                        }
                    }
                }
            }
        }
        tests.add(new Object[]{"3M2D4M", 0, 8, "3M2D4M"});
        tests.add(new Object[]{"3M2D4M", 2, 8, "1M2D4M"});
        tests.add(new Object[]{"3M2D4M", 2, 6, "1M2D2M"});
        tests.add(new Object[]{"3M2D4M", 3, 6, "2D2M"});
        tests.add(new Object[]{"3M2D4M", 4, 6, "1D2M"});
        tests.add(new Object[]{"3M2D4M", 5, 6, "2M"});
        tests.add(new Object[]{"3M2D4M", 6, 6, "1M"});
        tests.add(new Object[]{"2M3I4M", 0, 5, "2M3I4M"});
        tests.add(new Object[]{"2M3I4M", 1, 5, "1M3I4M"});
        tests.add(new Object[]{"2M3I4M", 1, 4, "1M3I3M"});
        tests.add(new Object[]{"2M3I4M", 2, 4, "3I3M"});
        tests.add(new Object[]{"2M3I4M", 2, 3, "3I2M"});
        tests.add(new Object[]{"2M3I4M", 2, 2, "3I1M"});
        tests.add(new Object[]{"2M3I4M", 3, 4, "2M"});
        tests.add(new Object[]{"2M3I4M", 3, 3, "1M"});
        tests.add(new Object[]{"2M3I4M", 4, 4, "1M"});
        // this doesn't work -- but I'm not sure it should
        //        tests.add(new Object[]{"2M3I4M", 2, 1, "3I"});
        return tests.toArray(new Object[][]{});
    }
tests.add(new Object[]{"2M3I4M", 3, 3, "1M"});
tests.add(new Object[]{"2M3I4M", 4, 4, "1M"});
// this doesn't work -- but I'm not sure it should
// tests.add(new Object[]{"2M3I4M", 2, 1, "3I"});
return tests.toArray(new Object[][]{});
}
tests.add(new Object[]{"3M2D4M", 6, 6, "1M"});
tests.add(new Object[]{"2M3I4M", 0, 5, "2M3I4M"});
tests.add(new Object[]{"2M3I4M", 1, 5, "1M3I4M"});
tests.add(new Object[]{"2M3I4M", 1, 4, "1M3I3M"});
tests.add(new Object[]{"2M3I4M", 2, 4, "3I3M"});
tests.add(new Object[]{"2M3I4M", 2, 3, "3I2M"});
tests.add(new Object[]{"2M3I4M", 2, 2, "3I1M"});
tests.add(new Object[]{"2M3I4M", 3, 4, "2M"});
tests.add(new Object[]{"2M3I4M", 3, 3, "1M"});
tests.add(new Object[]{"2M3I4M", 4, 4, "1M"});
// this doesn't work -- but I'm not sure it should
// tests.add(new Object[]{"2M3I4M", 2, 1, "3I"});
return tests.toArray(new Object[][]{});
}
}
}
}
}
tests.add(new Object[]{"3M2D4M", 0, 8, "3M2D4M"});
tests.add(new Object[]{"3M2D4M", 2, 8, "1M2D4M"});
tests.add(new Object[]{"3M2D4M", 2, 6, "1M2D2M"});
tests.add(new Object[]{"3M2D4M", 3, 6, "2D2M"});
tests.add(new Object[]{"3M2D4M", 4, 6, "1D2M"});
tests.add(new Object[]{"3M2D4M", 5, 6, "2M"});
tests.add(new Object[]{"3M2D4M", 6, 6, "1M"});
tests.add(new Object[]{"2M3I4M", 0, 5, "2M3I4M"});
tests.add(new Object[]{"2M3I4M", 1, 5, "1M3I4M"});
tests.add(new Object[]{"2M3I4M", 1, 4, "1M3I3M"});
tests.add(new Object[]{"2M3I4M", 2, 4, "3I3M"});
tests.add(new Object[]{"2M3I4M", 2, 3, "3I2M"});
tests.add(new Object[]{"2M3I4M", 2, 2, "3I1M"});
tests.add(new Object[]{"2M3I4M", 3, 4, "2M"});
tests.add(new Object[]{"2M3I4M", 3, 3, "1M"});
tests.add(new Object[]{"2M3I4M", 4, 4, "1M"});
// this doesn't work -- but I'm not sure it should
// tests.add(new Object[]{"2M3I4M", 2, 1, "3I"});
return tests.toArray(new Object[][]{});
}