@Test public void testOrder() throws InvalidPatternException { List<String> result; result = newGlobExpander().expand("{a,b}"); assertEquals(result, Arrays.asList("a","b"), "Expansion was "+result); result = newGlobExpander().expand("{{a},b}"); assertEquals(result, Arrays.asList("a","b"), "Expansion was "+result); result = newGlobExpander().expand("{a,b}{1,2}"); assertEquals(result, Arrays.asList("a1","a2","b1","b2"), "Expansion was "+result); result = newGlobExpander().expand("{80{8{1,2},90},8000+}"); assertEquals(result, Arrays.asList("8081","8082","8090","8000+"), "Expansion was "+result); }
@Test public void testNum() throws InvalidPatternException { assertTrue(newGlobExpander().isGlobMatchedNumeric("{1-3}", "1")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{1-3}", "a1")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a1")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a3")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a5")); assertFalse(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a4")); assertFalse(newGlobExpander().isGlobMatchedNumeric("a{1-3,5}", "a01")); }
@Test public void testNumLeadZero() throws InvalidPatternException { assertTrue(newGlobExpander().isGlobMatchedNumeric("a{01-03,05}", "a01")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{ 01 - 03 , 05 }", "a01")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{ 01 - 03 , 05 }", "a02")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{ 01 - 03 , 05 }", "a03")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{ 01 - 03 , 05 }", "a 05 ")); assertTrue(newGlobExpander().isGlobMatchedNumeric("a{01-03,05}", "a05")); assertFalse(newGlobExpander().isGlobMatchedNumeric("a{01-03,05}", "a04")); assertFalse(newGlobExpander().isGlobMatchedNumeric("a{01-03,05}", "a3")); }