aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-29 02:50:31 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-29 02:50:31 +0200
commit96326442317abc02adb602f825b284a844c862fe (patch)
treef88a861ff8ddc9a2236ff9d05a19b3be237190e5 /tests
parent064258c7bb285163fe2deabe411e39c2b9d1e755 (diff)
Fix unit test for fstree_gen_inode_table
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests')
-rw-r--r--tests/gen_inode_table.c17
1 files changed, 6 insertions, 11 deletions
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);