forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoundRobinTest.java
More file actions
26 lines (21 loc) · 780 Bytes
/
RoundRobinTest.java
File metadata and controls
26 lines (21 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package src.test.java.com.others;
import org.junit.Assert;
import org.junit.Test;
import src.main.java.com.others.RoundRobin;
public class RoundRobinTest {
private final int[] burstTime = {5, 15, 4, 3};
private final RoundRobin roundRobin = new RoundRobin();
@Test
public void testWaitingTime() {
int[] expectedTime = {9, 12, 14, 9};
int[] realtime = roundRobin.calcWaitingTime(burstTime, 3);
Assert.assertArrayEquals(realtime, expectedTime);
}
@Test
public void testTurnAroundTIme() {
int[] expectedTIme = {14, 27, 18, 12};
int[] waitingTime = {9, 12, 14, 9};
int[] realTime = roundRobin.calcTurnAroundTime(burstTime, waitingTime);
Assert.assertArrayEquals(realTime, expectedTIme);
}
}