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()
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