Skip to content

Commit

Permalink
Dodati testeri za algo planner
Browse files Browse the repository at this point in the history
  • Loading branch information
Veliki5382 committed Mar 30, 2024
1 parent 00a7a8a commit 3586add
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .vscode/settings.json
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
}
42 changes: 42 additions & 0 deletions src/test_algo_planner.py
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

0 comments on commit 3586add

Please sign in to comment.