legacy/libisofs/trunk/test/test_file_hashtable.c

51 lines
1008 B
C
Raw Normal View History

2007-06-01 12:57:09 +00:00
/*
* Unit test for file.h
2007-06-01 12:57:09 +00:00
*/
#include "test.h"
#include "file.h"
#include "tree.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void test_cache_inodes()
{
struct iso_file_table *table;
struct iso_tree_node_file *file1;
struct iso_tree_node_file *file2;
struct iso_tree_node_file *file3;
struct iso_file *iso1;
table = iso_file_table_new(1);
CU_ASSERT_PTR_NOT_NULL( table );
CU_ASSERT_TRUE( table->cache_inodes );
2007-06-01 12:57:09 +00:00
file1 = calloc(1, sizeof(struct iso_tree_node_file) );
file1->node.name = "fileName";
file1->node.attrib.st_size = 12;
file1->node.attrib.st_dev = 15;
file1->node.attrib.st_ino = 204;
file1->path = "/tmp/filename";
file1->sort_weight = 1;
iso1 = iso_file_new(file1);
CU_ASSERT_STRING_EQUAL(iso1->path, "/tmp/filename");
2007-06-01 12:57:09 +00:00
//TODO
free( file1 );
}
void add_file_hashtable_suite()
2007-06-01 12:57:09 +00:00
{
CU_pSuite pSuite = CU_add_suite("FileHashtableSuite", NULL, NULL);
CU_add_test(pSuite, "test of cache_inodes", test_cache_inodes);
2007-06-01 12:57:09 +00:00
}