Adopted compile-time LFS_MIN/LFS_MAX in test defines
These seem fitting here, even if the test defines aren't "real defines". The duplicate expressions should still be side-effect free and easy to optimize out. This should also avoid future lfs_min32 vs intmax_t issues.
This commit is contained in:
@@ -3992,10 +3992,10 @@ code = '''
|
||||
// note if we lose power we may not have the magic string in both blocks!
|
||||
// but we don't lose power in this test so we can assert the magic string
|
||||
// is present in both
|
||||
uint8_t magic[lfs_max(16, READ_SIZE)];
|
||||
CFG->read(CFG, 0, 0, magic, lfs_max(16, READ_SIZE)) => 0;
|
||||
uint8_t magic[LFS_MAX(16, READ_SIZE)];
|
||||
CFG->read(CFG, 0, 0, magic, LFS_MAX(16, READ_SIZE)) => 0;
|
||||
assert(memcmp(&magic[8], "littlefs", 8) == 0);
|
||||
CFG->read(CFG, 1, 0, magic, lfs_max(16, READ_SIZE)) => 0;
|
||||
CFG->read(CFG, 1, 0, magic, LFS_MAX(16, READ_SIZE)) => 0;
|
||||
assert(memcmp(&magic[8], "littlefs", 8) == 0);
|
||||
'''
|
||||
|
||||
@@ -4046,10 +4046,10 @@ code = '''
|
||||
// note if we lose power we may not have the magic string in both blocks!
|
||||
// but we don't lose power in this test so we can assert the magic string
|
||||
// is present in both
|
||||
uint8_t magic[lfs_max(16, READ_SIZE)];
|
||||
CFG->read(CFG, 0, 0, magic, lfs_max(16, READ_SIZE)) => 0;
|
||||
uint8_t magic[LFS_MAX(16, READ_SIZE)];
|
||||
CFG->read(CFG, 0, 0, magic, LFS_MAX(16, READ_SIZE)) => 0;
|
||||
assert(memcmp(&magic[8], "littlefs", 8) == 0);
|
||||
CFG->read(CFG, 1, 0, magic, lfs_max(16, READ_SIZE)) => 0;
|
||||
CFG->read(CFG, 1, 0, magic, LFS_MAX(16, READ_SIZE)) => 0;
|
||||
assert(memcmp(&magic[8], "littlefs", 8) == 0);
|
||||
'''
|
||||
|
||||
@@ -4117,9 +4117,9 @@ code = '''
|
||||
// note if we lose power we may not have the magic string in both blocks!
|
||||
// but we don't lose power in this test so we can assert the magic string
|
||||
// is present in both
|
||||
uint8_t magic[lfs_max(16, READ_SIZE)];
|
||||
CFG->read(CFG, 0, 0, magic, lfs_max(16, READ_SIZE)) => 0;
|
||||
uint8_t magic[LFS_MAX(16, READ_SIZE)];
|
||||
CFG->read(CFG, 0, 0, magic, LFS_MAX(16, READ_SIZE)) => 0;
|
||||
assert(memcmp(&magic[8], "littlefs", 8) == 0);
|
||||
CFG->read(CFG, 1, 0, magic, lfs_max(16, READ_SIZE)) => 0;
|
||||
CFG->read(CFG, 1, 0, magic, LFS_MAX(16, READ_SIZE)) => 0;
|
||||
assert(memcmp(&magic[8], "littlefs", 8) == 0);
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user