aboutsummaryrefslogtreecommitdiffziptar.gz
path: root/scripts/test_thread_instr.py
blob: d23e440525d6e26c12652f64702e548fc934d0e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import sys
import unittest
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent))
import thread_instr as ti


class ThreadInstrTests(unittest.TestCase):
    def test_sums_threads_by_name(self):
        text = "\n".join([
            "Game.Desk-100,5000,,instructions:u,100,100.00,,",
            "audio-101,300,,instructions:u,100,100.00,,",
            "audio-102,200,,instructions:u,100,100.00,,",
            "gl0-103,<not counted>,,instructions:u,0,0.00,,",
        ])
        self.assertEqual(ti.parse(text), {"Game.Desk": 5000, "audio": 500})


if __name__ == "__main__":
    unittest.main()