34 lines
835 B
Python
34 lines
835 B
Python
import sys
|
|
import os
|
|
import unittest
|
|
import time
|
|
|
|
import uLib
|
|
|
|
class TestCoreOptions(unittest.TestCase):
|
|
def test_options(self):
|
|
opt = uLib.Core.Options("Test Options")
|
|
|
|
# Test basic config file parsing
|
|
with open("test_configuration.ini", "w") as f:
|
|
f.write("[Section]\n")
|
|
|
|
opt.parse_config_file("test_configuration.ini")
|
|
os.remove("test_configuration.ini")
|
|
|
|
class TestCoreObject(unittest.TestCase):
|
|
def test_object(self):
|
|
obj = uLib.Core.Object()
|
|
self.assertIsNotNone(obj)
|
|
|
|
class TestCoreTimer(unittest.TestCase):
|
|
def test_timer(self):
|
|
timer = uLib.Core.Timer()
|
|
timer.Start()
|
|
time.sleep(0.1)
|
|
val = timer.StopWatch()
|
|
self.assertGreater(val, 0.09)
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|