# These tests are for some specific corner cases with neighboring inline files.
# Note that these tests are intended for 512 byte inline sizes. They should
# still pass with other inline sizes but wouldn't be testing anything.

define.LFS_CACHE_SIZE = 512
if = 'LFS_CACHE_SIZE % LFS_PROG_SIZE == 0 && LFS_CACHE_SIZE == 512'

[[case]] # entry grow test
code = '''
    uint8_t wbuffer[1024];
    uint8_t rbuffer[1024];

    lfs_format(&lfs, &cfg) => 0;
    lfs_mount(&lfs, &cfg) => 0;

    // write hi0 20
    sprintf(path, "hi0"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 20
    sprintf(path, "hi1"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi2 20
    sprintf(path, "hi2"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi3 20
    sprintf(path, "hi3"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    // read hi1 20
    sprintf(path, "hi1"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    // read hi0 20
    sprintf(path, "hi0"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi2 20
    sprintf(path, "hi2"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi3 20
    sprintf(path, "hi3"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;

    lfs_unmount(&lfs) => 0;
'''

[[case]] # entry shrink test
code = '''
    uint8_t wbuffer[1024];
    uint8_t rbuffer[1024];

    lfs_format(&lfs, &cfg) => 0;
    lfs_mount(&lfs, &cfg) => 0;

    // write hi0 20
    sprintf(path, "hi0"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi2 20
    sprintf(path, "hi2"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi3 20
    sprintf(path, "hi3"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    // read hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 20
    sprintf(path, "hi1"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    // read hi0 20
    sprintf(path, "hi0"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi1 20
    sprintf(path, "hi1"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi2 20
    sprintf(path, "hi2"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi3 20
    sprintf(path, "hi3"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;

    lfs_unmount(&lfs) => 0;
'''

[[case]] # entry spill test
code = '''
    uint8_t wbuffer[1024];
    uint8_t rbuffer[1024];

    lfs_format(&lfs, &cfg) => 0;
    lfs_mount(&lfs, &cfg) => 0;

    // write hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi2 200
    sprintf(path, "hi2"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi3 200
    sprintf(path, "hi3"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    // read hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi2 200
    sprintf(path, "hi2"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi3 200
    sprintf(path, "hi3"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;

    lfs_unmount(&lfs) => 0;
'''

[[case]] # entry push spill test
code = '''
    uint8_t wbuffer[1024];
    uint8_t rbuffer[1024];

    lfs_format(&lfs, &cfg) => 0;
    lfs_mount(&lfs, &cfg) => 0;

    // write hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 20
    sprintf(path, "hi1"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi2 200
    sprintf(path, "hi2"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi3 200
    sprintf(path, "hi3"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    // read hi1 20
    sprintf(path, "hi1"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    // read hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi2 200
    sprintf(path, "hi2"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi3 200
    sprintf(path, "hi3"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;

    lfs_unmount(&lfs) => 0;
'''

[[case]] # entry push spill two test
code = '''
    uint8_t wbuffer[1024];
    uint8_t rbuffer[1024];

    lfs_format(&lfs, &cfg) => 0;
    lfs_mount(&lfs, &cfg) => 0;

    // write hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 20
    sprintf(path, "hi1"); size = 20;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi2 200
    sprintf(path, "hi2"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi3 200
    sprintf(path, "hi3"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi4 200
    sprintf(path, "hi4"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    // read hi1 20
    sprintf(path, "hi1"); size = 20;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    // read hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi2 200
    sprintf(path, "hi2"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi3 200
    sprintf(path, "hi3"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi4 200
    sprintf(path, "hi4"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;

    lfs_unmount(&lfs) => 0;
'''

[[case]] # entry drop test
code = '''
    uint8_t wbuffer[1024];
    uint8_t rbuffer[1024];

    lfs_format(&lfs, &cfg) => 0;
    lfs_mount(&lfs, &cfg) => 0;

    // write hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi1 200
    sprintf(path, "hi1"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi2 200
    sprintf(path, "hi2"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;
    // write hi3 200
    sprintf(path, "hi3"); size = 200;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_close(&lfs, &file) => 0;

    lfs_remove(&lfs, "hi1") => 0;
    lfs_stat(&lfs, "hi1", &info) => LFS_ERR_NOENT;
    // read hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi2 200
    sprintf(path, "hi2"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi3 200
    sprintf(path, "hi3"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;

    lfs_remove(&lfs, "hi2") => 0;
    lfs_stat(&lfs, "hi2", &info) => LFS_ERR_NOENT;
    // read hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    // read hi3 200
    sprintf(path, "hi3"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;

    lfs_remove(&lfs, "hi3") => 0;
    lfs_stat(&lfs, "hi3", &info) => LFS_ERR_NOENT;
    // read hi0 200
    sprintf(path, "hi0"); size = 200;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_size(&lfs, &file) => size;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;

    lfs_remove(&lfs, "hi0") => 0;
    lfs_stat(&lfs, "hi0", &info) => LFS_ERR_NOENT;

    lfs_unmount(&lfs) => 0;
'''

[[case]] # create too big
code = '''
    lfs_format(&lfs, &cfg) => 0;

    lfs_mount(&lfs, &cfg) => 0;
    memset(path, 'm', 200);
    path[200] = '\0';

    size = 400;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    uint8_t wbuffer[1024];
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_close(&lfs, &file) => 0;

    size = 400;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    uint8_t rbuffer[1024];
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    lfs_unmount(&lfs) => 0;
'''

[[case]] # resize too big
code = '''
    lfs_format(&lfs, &cfg) => 0;

    lfs_mount(&lfs, &cfg) => 0;
    memset(path, 'm', 200);
    path[200] = '\0';

    size = 40;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    uint8_t wbuffer[1024];
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_close(&lfs, &file) => 0;

    size = 40;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    uint8_t rbuffer[1024];
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;

    size = 400;
    lfs_file_open(&lfs, &file, path,
            LFS_O_WRONLY | LFS_O_CREAT | LFS_O_TRUNC) => 0;
    memset(wbuffer, 'c', size);
    lfs_file_write(&lfs, &file, wbuffer, size) => size;
    lfs_file_close(&lfs, &file) => 0;

    size = 400;
    lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) => 0;
    lfs_file_read(&lfs, &file, rbuffer, size) => size;
    memcmp(rbuffer, wbuffer, size) => 0;
    lfs_file_close(&lfs, &file) => 0;
    lfs_unmount(&lfs) => 0;
'''
