Migrated the first of the tests with internal knowledge
Both test_move and test_orphan needed internal knowledge which comes with the addition of the "in" attribute. This was in the plan for the test-revamp from the beginning as it really opens up the ability to write more unit-style-tests using internal knowledge of how littlefs works. More unit-style-tests should help _fix_ bugs by limiting the scope of the test and where the bug could be hiding. The "in" attribute effectively runs tests _inside_ the .c file specified, giving the test access to all static members without needed to change their visibility.
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
|
||||
[[case]] # interspersed file test
|
||||
# TODO FILES=26 found bug
|
||||
#define.SIZE = [10, 100]
|
||||
#define.FILES = [4, 10, 26]
|
||||
define = [
|
||||
{SIZE=10, FILES=4},
|
||||
{SIZE=10, FILES=10},
|
||||
#{SIZE=10, FILES=26},
|
||||
{SIZE=100, FILES=4},
|
||||
{SIZE=100, FILES=10},
|
||||
#{SIZE=100, FILES=26},
|
||||
]
|
||||
code = '''
|
||||
lfs_file_t files[FILES];
|
||||
const char alphas[] = "abcdefghijklmnopqrstuvwxyz";
|
||||
@@ -56,19 +67,10 @@ code = '''
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
'''
|
||||
# TODO FILES=26 found bug
|
||||
#define.SIZE = [10, 100]
|
||||
#define.FILES = [4, 10, 26]
|
||||
define = [
|
||||
{SIZE=10, FILES=4},
|
||||
{SIZE=10, FILES=10},
|
||||
#{SIZE=10, FILES=26},
|
||||
{SIZE=100, FILES=4},
|
||||
{SIZE=100, FILES=10},
|
||||
#{SIZE=100, FILES=26},
|
||||
]
|
||||
|
||||
[[case]] # interspersed remove file test
|
||||
define.SIZE = [10, 100]
|
||||
define.FILES = [4, 10, 26]
|
||||
code = '''
|
||||
const char alphas[] = "abcdefghijklmnopqrstuvwxyz";
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
@@ -118,10 +120,9 @@ code = '''
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
'''
|
||||
define.SIZE = [10, 100]
|
||||
define.FILES = [4, 10, 26]
|
||||
|
||||
[[case]] # remove inconveniently test
|
||||
define.SIZE = [10, 100]
|
||||
code = '''
|
||||
lfs_format(&lfs, &cfg) => 0;
|
||||
lfs_mount(&lfs, &cfg) => 0;
|
||||
@@ -179,9 +180,20 @@ code = '''
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
'''
|
||||
define.SIZE = [10, 100]
|
||||
|
||||
[[case]] # reentrant interspersed file test
|
||||
# TODO FILES=26 found bug
|
||||
#define.SIZE = [10, 100]
|
||||
#define.FILES = [4, 10, 26]
|
||||
define = [
|
||||
{SIZE=10, FILES=4},
|
||||
{SIZE=10, FILES=10},
|
||||
#{SIZE=10, FILES=26},
|
||||
{SIZE=100, FILES=4},
|
||||
#{SIZE=100, FILES=10},
|
||||
#{SIZE=100, FILES=26},
|
||||
]
|
||||
reentrant = true
|
||||
code = '''
|
||||
lfs_file_t files[FILES];
|
||||
const char alphas[] = "abcdefghijklmnopqrstuvwxyz";
|
||||
@@ -248,15 +260,3 @@ code = '''
|
||||
|
||||
lfs_unmount(&lfs) => 0;
|
||||
'''
|
||||
# TODO FILES=26 found bug
|
||||
#define.SIZE = [10, 100]
|
||||
#define.FILES = [4, 10, 26]
|
||||
define = [
|
||||
{SIZE=10, FILES=4},
|
||||
{SIZE=10, FILES=10},
|
||||
#{SIZE=10, FILES=26},
|
||||
{SIZE=100, FILES=4},
|
||||
#{SIZE=100, FILES=10},
|
||||
#{SIZE=100, FILES=26},
|
||||
]
|
||||
reentrant = true
|
||||
|
||||
Reference in New Issue
Block a user