Пример #1
0
  @Test
  public void test1() {
    PermissionTree pt = new PermissionTree();
    int[] homeDirs = pt.findHome(new String[] {"0 Admin"}, new String[] {"Peter", "Paul", "Mary"});

    Assert.assertArrayEquals(new int[] {-1, -1, -1}, homeDirs);
  }
Пример #2
0
 @Test
 public void test0() {
   PermissionTree pt = new PermissionTree();
   int[] homeDirs =
       pt.findHome(
           new String[] {"0 Admin", "0 Joe,Phil", "0 Joe"}, new String[] {"Admin", "Joe", "Phil"});
   Assert.assertArrayEquals(new int[] {0, 0, 1}, homeDirs);
 }
Пример #3
0
 @Test
 public void test2() {
   PermissionTree pt = new PermissionTree();
   int[] homeDirs =
       pt.findHome(
           new String[] {"0 Admin", "2 John", "0 Peter,John", "0 Tim", "1 John"},
           new String[] {"John"});
   Assert.assertArrayEquals(new int[] {2}, homeDirs);
 }
Пример #4
0
  @Test
  public void test3() {
    PermissionTree pt = new PermissionTree();
    int[] homeDirs =
        pt.findHome(
            new String[] {
              "0 Admin",
              "0 Jeff",
              "1 Mark,Tim",
              "1 Tim,Jeff",
              "0 Dan",
              "4 Ed",
              "4 Tom",
              "4 Kyle,Ed",
              "0 Ben",
              "8 Rich",
              "8 Sam",
              "8 Tim"
            },
            new String[] {"Jeff", "Ed", "Tim", "Steve"});

    Assert.assertArrayEquals(new int[] {1, 4, 0, -1}, homeDirs);
  }