From 96326442317abc02adb602f825b284a844c862fe Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 29 Sep 2019 02:50:31 +0200 Subject: Fix unit test for fstree_gen_inode_table Signed-off-by: David Oberhollenzer --- tests/gen_inode_table.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/gen_inode_table.c b/tests/gen_inode_table.c index 55f543e..d70f463 100644 --- a/tests/gen_inode_table.c +++ b/tests/gen_inode_table.c @@ -56,11 +56,9 @@ int main(void) // inode table for the empty tree assert(fstree_init(&fs, NULL) == 0); assert(fstree_gen_inode_table(&fs) == 0); - assert(fs.inode_tbl_size == 3); - assert(fs.root->inode_num == 2); - assert(fs.inode_table[0] == NULL); - assert(fs.inode_table[1] == NULL); - assert(fs.inode_table[2] == fs.root); + assert(fs.inode_tbl_size == 1); + assert(fs.root->inode_num == 1); + assert(fs.inode_table[0] == fs.root); fstree_cleanup(&fs); // tree with 2 levels under root, fan out 3 @@ -86,14 +84,11 @@ int main(void) assert(gen_node(c, "c_c") != NULL); assert(fstree_gen_inode_table(&fs) == 0); + assert(fs.inode_tbl_size == 13); - assert(fs.inode_tbl_size == (13 + 2)); - assert(fs.inode_table[0] == NULL); - assert(fs.inode_table[1] == NULL); - - for (i = 2; i < (13 + 2); ++i) { + for (i = 0; i < 13; ++i) { assert(fs.inode_table[i] != NULL); - assert(fs.inode_table[i]->inode_num == i); + assert(fs.inode_table[i]->inode_num == i + 1); } check_children_before_root(fs.root); -- cgit v1.2.3