Little unit test.

release-1.5.4.branch
Vreixo Formoso 15 years ago
parent bd893a8cfa
commit af89d11512
  1. 2
      Roadmap
  2. 31
      test/test_node.c

@ -4,7 +4,7 @@
-> Expose node extended info. Always compile it.
(little memory cost)
-> Review builder / tree / node relation
-> Add low level functions to create nodes.
OK -> Add low level functions to create nodes.
-> Optimize storage of children in node?
-> Inode object?

@ -9,6 +9,34 @@
#include <stdlib.h>
static
void test_iso_node_new_dir()
{
int ret;
IsoDir *dir;
char *name;
name = strdup("name1");
ret = iso_node_new_dir(name, &dir);
CU_ASSERT_EQUAL(ret, ISO_SUCCESS);
CU_ASSERT_EQUAL(dir->node.refcount, 1);
CU_ASSERT_EQUAL(dir->node.type, LIBISO_DIR);
CU_ASSERT_EQUAL(dir->node.mode, S_IFDIR);
CU_ASSERT_EQUAL(dir->node.uid, 0);
CU_ASSERT_EQUAL(dir->node.gid, 0);
CU_ASSERT_EQUAL(dir->node.atime, 0);
CU_ASSERT_EQUAL(dir->node.mtime, 0);
CU_ASSERT_EQUAL(dir->node.ctime, 0);
CU_ASSERT_STRING_EQUAL(dir->node.name, "name1");
CU_ASSERT_EQUAL(dir->node.hidden, 0);
CU_ASSERT_PTR_NULL(dir->node.parent);
CU_ASSERT_PTR_NULL(dir->node.next);
CU_ASSERT_EQUAL(dir->nchildren, 0);
CU_ASSERT_PTR_NULL(dir->children);
iso_node_unref((IsoNode*)dir);
}
static
void test_iso_node_set_permissions()
{
@ -575,7 +603,8 @@ void add_node_suite()
{
CU_pSuite pSuite = CU_add_suite("Node Test Suite", NULL, NULL);
CU_add_test(pSuite, "iso_node_set_permissions()", test_iso_node_set_permissions);
CU_add_test(pSuite, "iso_node_new_dir()", test_iso_node_new_dir);
CU_add_test(pSuite, "iso_node_set_permissions()", test_iso_node_set_permissions);
CU_add_test(pSuite, "iso_node_get_permissions()", test_iso_node_get_permissions);
CU_add_test(pSuite, "iso_node_get_mode()", test_iso_node_get_mode);
CU_add_test(pSuite, "iso_node_set_uid()", test_iso_node_set_uid);

Loading…
Cancel
Save