Exemple #1
0
def test_timespec_cmp():
    t1 = Timespec(1, 10)
    t2 = Timespec(1, 20)
    assert (t1 < t2)

    t1 = Timespec(1, 10)
    t2 = Timespec(2, 10)
    assert (t1 < t2)

    t1 = Timespec(10, 10)
    t2 = Timespec(10, 10)
    assert (t1 == t2)
Exemple #2
0
def test_timespec_sub():
    t1 = Timespec(10, 2)
    t2 = Timespec(20, 1)
    diff = t2.sub(t1)
    assert (diff == Timespec(9, 999999999))
def test_timespec_sub():
    t1 = Timespec(10, 2)
    t2 = Timespec(20, 1)
    diff = t2.sub(t1)
    assert(diff == Timespec(9, 999999999))
Exemple #4
0
def test_timespec_float():
    ts = Timespec(3, 141600000)
    assert (abs(ts.float() - 3.1416) < 0.0001)
def test_timespec_float():
    ts = Timespec(3, 141600000)
    assert(abs(ts.float() - 3.1416) < 0.0001)