Exemplo n.º 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"));
 }
Exemplo n.º 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");
 }
Exemplo n.º 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);
 }
Exemplo n.º 4
0
 @Test
 public void testIsMaskValid() {
   assertTrue(IRC.isMaskValid("*!*@*"));
   assertTrue(IRC.isMaskValid("?!*@*"));
   assertTrue(IRC.isMaskValid("?!*@abc?de"));
   assertTrue(IRC.isMaskValid("?*@*"));
 }
Exemplo n.º 5
0
 @Test
 public void testIsNicknameValid() {
   assertTrue(IRC.isNicknameValid("a"));
   assertTrue(IRC.isNicknameValid("a0"));
   assertTrue(!IRC.isNicknameValid("0abc"));
   assertTrue(!IRC.isNicknameValid("-abc"));
 }
Exemplo n.º 6
0
 @Test
 public void testIsHostmaskValid() {
   assertTrue(IRC.isHostmaskValid("[email protected]"));
   assertTrue(!IRC.isHostmaskValid("[email protected]"));
   assertTrue(!IRC.isHostmaskValid("?!*@abc?de"));
   assertTrue(!IRC.isHostmaskValid("?*@*"));
 }
Exemplo n.º 7
0
 @Test
 public void testIsSafeChannelNameValid() {
   assertTrue(IRC.isSafeChannelNameValid("!abc"));
   assertTrue(IRC.isSafeChannelNameValid("!#abc"));
   assertTrue(!IRC.isSafeChannelNameValid("#abc"));
   assertTrue(!IRC.isSafeChannelNameValid("+abc"));
 }
Exemplo n.º 8
0
 @Test
 public void testIsChannelNameValid() {
   assertTrue(IRC.isChannelNameValid("#abc"));
   assertTrue(IRC.isChannelNameValid("&abc"));
   assertTrue(IRC.isChannelNameValid("+abc"));
   assertTrue(IRC.isChannelNameValid("!abc"));
 }
Exemplo n.º 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@*");
 }
Exemplo n.º 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");
  }
Exemplo n.º 11
0
 @Test
 public void testGenerateSafeChannelID() {
   assertTrue(!IRC.generateSafeChannelID().contains("abcdefghijklmnopqrstuvwxyz"));
 }