Пример #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"));
 }