-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00a7a8a
commit 3586add
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"python.testing.pytestArgs": [ | ||
"src" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import pytest | ||
from algorithmPlanner import * | ||
from process import Process | ||
from operatingSystem import OS | ||
from cpu import CPU | ||
|
||
def test_queue_order(): | ||
cpu = CPU() | ||
os = OS(cpu, FirstComeFirstServe()) | ||
cpu.setOS(os) | ||
|
||
p1 = Process(5, 30, 2) | ||
p3 = Process(6, 20, 2) | ||
p2 = Process(3, 25, 1) | ||
|
||
os.createProcess(p1) | ||
os.createProcess(p2) | ||
os.createProcess(p3) | ||
|
||
|
||
assert os.getProcess() == p1 | ||
assert os.getProcess() == p2 | ||
assert os.getProcess() == p3 | ||
|
||
def test_priority_queue_order(): | ||
cpu = CPU() | ||
os = OS(cpu, ShortestProcessFirst()) | ||
cpu.setOS(os) | ||
|
||
p1 = Process(5, 30, 2) | ||
p2 = Process(6, 20, 2) | ||
p3 = Process(3, 25, 1) | ||
|
||
os.createProcess(p1) | ||
os.createProcess(p2) | ||
os.createProcess(p3) | ||
|
||
|
||
assert os.getProcess() == p2 | ||
assert os.getProcess() == p3 | ||
assert os.getProcess() == p1 | ||
|