Ejemplo n.º 1
0
def test_get_logname():
    path = ffi.new('char [2048]', b'foobar/')
    idnum = 3
    filename = ffi.new('char [2048]')
    print([type(o) for o in (path, idnum, filename)])
    assert vic_lib.get_logname(path, idnum, filename) is None
    print(ffi.string(filename))
    assert len(ffi.string(filename)) > 0
Ejemplo n.º 2
0
def test_get_current_datetime():
    dts = ffi.new('char [2048]')
    assert len(ffi.string(dts)) == 0
    vic_lib.get_current_datetime(dts)
    assert len(ffi.string(dts)) == 14
    now = datetime.datetime.now()
    now_string = now.strftime('%Y%m%d')
    assert now_string == ffi.string(dts)[:8].decode()
Ejemplo n.º 3
0
def dmy(scope='function'):
    d = ffi.new('dmy_struct *')
    d[0].day = 1
    d[0].day_in_year = 1
    d[0].dayseconds = 1234
    d[0].month = 1
    d[0].year = 1984
    return d