51 lines
1008 B
C
51 lines
1008 B
C
/*
|
|
* Unit test for file.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;
|
|
|
|
table = iso_file_table_new(1);
|
|
|
|
CU_ASSERT_PTR_NOT_NULL( table );
|
|
CU_ASSERT_TRUE( 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);
|
|
|
|
CU_ASSERT_STRING_EQUAL(iso1->path, "/tmp/filename");
|
|
|
|
//TODO
|
|
|
|
free( file1 );
|
|
}
|
|
|
|
|
|
void add_file_hashtable_suite()
|
|
{
|
|
CU_pSuite pSuite = CU_add_suite("FileHashtableSuite", NULL, NULL);
|
|
CU_add_test(pSuite, "test of cache_inodes", test_cache_inodes);
|
|
}
|