Search in sources :

Example 11 with Pair

use of iurii.job.interview.utils.pair.Pair in project algorithms by Iurii-Dziuban.

the class ProcessorsForTasksTest method testNegativeWithSorting.

@Test
public void testNegativeWithSorting() {
    List<Pair> pairs = new ArrayList<>();
    pairs.add(new Pair(1481122000, 1481122025));
    pairs.add(new Pair(1481122030, 1481122045));
    pairs.add(new Pair(1481122050, 1481122070));
    assertThat(processorsForTasks.findTotalNumberOfProcessorsNeededWithSorting(pairs)).isEqualTo(1);
}
Also used : ArrayList(java.util.ArrayList) Pair(iurii.job.interview.utils.pair.Pair) Test(org.junit.Test)

Example 12 with Pair

use of iurii.job.interview.utils.pair.Pair in project algorithms by Iurii-Dziuban.

the class ProcessorsForTasksTest method testSimpleWithSorting.

@Test
public void testSimpleWithSorting() {
    List<Pair> pairs = new ArrayList<>();
    pairs.add(new Pair(1481122000, 1481122020));
    pairs.add(new Pair(1481122000, 1481122040));
    pairs.add(new Pair(1481122030, 1481122035));
    assertThat(processorsForTasks.findTotalNumberOfProcessorsNeededWithSorting(pairs)).isEqualTo(2);
}
Also used : ArrayList(java.util.ArrayList) Pair(iurii.job.interview.utils.pair.Pair) Test(org.junit.Test)

Example 13 with Pair

use of iurii.job.interview.utils.pair.Pair in project algorithms by Iurii-Dziuban.

the class ProcessorsForTasksTest method testOneWithSorting.

@Test
public void testOneWithSorting() {
    List<Pair> pairs = new ArrayList<>();
    pairs.add(new Pair(1481122000, 1481122020));
    pairs.add(new Pair(1481122020, 1481122040));
    pairs.add(new Pair(1481122040, 1481122050));
    assertThat(processorsForTasks.findTotalNumberOfProcessorsNeededWithSorting(pairs)).isEqualTo(1);
}
Also used : ArrayList(java.util.ArrayList) Pair(iurii.job.interview.utils.pair.Pair) Test(org.junit.Test)

Example 14 with Pair

use of iurii.job.interview.utils.pair.Pair in project algorithms by Iurii-Dziuban.

the class CustomerServiceCapacityTest method testSimple.

@Test
public void testSimple() {
    List<Pair> pairs = new ArrayList<>();
    pairs.add(new Pair(1481122000, 1481122020));
    pairs.add(new Pair(1481122000, 1481122040));
    pairs.add(new Pair(1481122030, 1481122035));
    assertThat(serviceCapacity.findNeededNumberOfEmployers(1, pairs)).isEqualTo(1);
}
Also used : ArrayList(java.util.ArrayList) Pair(iurii.job.interview.utils.pair.Pair) Test(org.junit.Test)

Aggregations

Pair (iurii.job.interview.utils.pair.Pair)14 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)10 ArrayDeque (java.util.ArrayDeque)1