File: test_monotonic_clock.py

package info (click to toggle)
2ping 4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 464 kB
  • sloc: python: 2,827; sh: 80; makefile: 38
file content (23 lines) | stat: -rw-r--r-- 530 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python3

import unittest
from twoping import monotonic_clock


clock = monotonic_clock.clock
clock_info = monotonic_clock.get_clock_info('clock')


class TestMonotonicClock(unittest.TestCase):
    def test_clock(self):
        self.assertEqual(type(clock()), float)

    @unittest.skipUnless(clock_info.monotonic, 'Monotonic clock required')
    def test_monotonic(self):
        time1 = clock()
        time2 = clock()
        self.assertGreaterEqual(time2, time1)


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