示例#1
0
 @Test
 public void testIsMaskMatched() {
   assertTrue(IRC.isMaskMatched("*!*@host.fr", "123!456@*"));
   assertTrue(IRC.isMaskMatched("???*[email protected]", "[email protected]"));
   assertTrue(IRC.isMaskMatched("[email protected]", "*!*@host.fr"));
   assertTrue(!IRC.isMaskMatched("1?3!4?6@*.fr", "*!*@host.fr"));
 }
示例#2
0
 @Test
 public void testGetMask() {
   assertEquals(IRC.getMask("*"), "*!*@*");
   assertEquals(IRC.getMask("abc"), "abc!*@*");
   assertEquals(IRC.getMask("abc@def"), "abc!*@def");
   assertEquals(IRC.getMask("abc?*@def"), "abc?*!*@def");
 }
示例#3
0
 @Test
 public void testGetHostmaskFromTokens() {
   assertEquals(IRC.getHostmaskFromTokens("abc", "def", "ghi"), "abc!def@ghi");
   assertEquals(IRC.getHostmaskFromTokens("abc", "def", "81.0.0.1"), "[email protected]");
   assertEquals(IRC.getHostmaskFromTokens("#abc", "def", "ghi"), null);
   assertEquals(IRC.getHostmaskFromTokens("ab*c", "*", "*"), null);
 }
示例#4
0
 @Test
 public void testIsMaskValid() {
   assertTrue(IRC.isMaskValid("*!*@*"));
   assertTrue(IRC.isMaskValid("?!*@*"));
   assertTrue(IRC.isMaskValid("?!*@abc?de"));
   assertTrue(IRC.isMaskValid("?*@*"));
 }
示例#5
0
 @Test
 public void testIsNicknameValid() {
   assertTrue(IRC.isNicknameValid("a"));
   assertTrue(IRC.isNicknameValid("a0"));
   assertTrue(!IRC.isNicknameValid("0abc"));
   assertTrue(!IRC.isNicknameValid("-abc"));
 }
示例#6
0
 @Test
 public void testIsHostmaskValid() {
   assertTrue(IRC.isHostmaskValid("[email protected]"));
   assertTrue(!IRC.isHostmaskValid("[email protected]"));
   assertTrue(!IRC.isHostmaskValid("?!*@abc?de"));
   assertTrue(!IRC.isHostmaskValid("?*@*"));
 }
示例#7
0
 @Test
 public void testIsSafeChannelNameValid() {
   assertTrue(IRC.isSafeChannelNameValid("!abc"));
   assertTrue(IRC.isSafeChannelNameValid("!#abc"));
   assertTrue(!IRC.isSafeChannelNameValid("#abc"));
   assertTrue(!IRC.isSafeChannelNameValid("+abc"));
 }
示例#8
0
 @Test
 public void testIsChannelNameValid() {
   assertTrue(IRC.isChannelNameValid("#abc"));
   assertTrue(IRC.isChannelNameValid("&abc"));
   assertTrue(IRC.isChannelNameValid("+abc"));
   assertTrue(IRC.isChannelNameValid("!abc"));
 }
示例#9
0
 @Test
 public void testGetMaskFromTokens() {
   assertEquals(IRC.getMaskFromTokens("?", "*", "*"), "?!*@*");
   assertEquals(IRC.getMaskFromTokens("*", "*", "81.0.0.1"), "*!*@81.0.0.1");
   assertEquals(IRC.getMaskFromTokens("@bc", "*", "*"), null);
   assertEquals(IRC.getMaskFromTokens("abc", "abc!def", "*"), "abc!abc!def@*");
 }
示例#10
0
  @Test
  public void testGetMaskTokens() {
    String[] tokens;

    tokens = IRC.getMaskTokens("a?c");
    assertEquals(tokens[0], "a?c");
    assertEquals(tokens[1], "*");
    assertEquals(tokens[2], "*");

    tokens = IRC.getMaskTokens("[email protected]");
    assertEquals(tokens[0], "a");
    assertEquals(tokens[1], "*");
    assertEquals(tokens[2], "81.0.0.1");
  }
示例#11
0
 @Test
 public void testGenerateSafeChannelID() {
   assertTrue(!IRC.generateSafeChannelID().contains("abcdefghijklmnopqrstuvwxyz"));
 }