legacy/libisofs/trunk/test/test_file_hashtable.c
2007-06-01 12:57:09 +00:00

105 lines
1.8 KiB
C

/*
* Unit test for exclude.h
*/
#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;
printf("Testing file hashtable with cache inodes...");
table = iso_file_table_new(1);
assert( table );
assert( table->cache_inodes );
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);
assert( !strcmp(iso1->path, "/tmp/filename") );
//TODO
free( file1 );
printf("\tOK\n");
}
void test_file_hashtable()
{
test_cache_inodes();
}
/*
* Unit test for exclude.h
*/
#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;
printf("Testing file hashtable with cache inodes...");
table = iso_file_table_new(1);
assert( table );
assert( table->cache_inodes );
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);
assert( !strcmp(iso1->path, "/tmp/filename") );
//TODO
free( file1 );
printf("\tOK\n");
}
void test_file_hashtable()
{
test_cache_inodes();
}