Implemented relaxed iso constraints & Cunit based unit-tests

This commit is contained in:
Mario Danic
2007-06-21 11:19:11 +00:00
parent 7faf1635a0
commit 14605541c9
15 changed files with 624 additions and 407 deletions

View File

@ -1,5 +1,5 @@
/*
* Unit test for exclude.h
* Unit test for file.h
*/
@ -20,12 +20,10 @@ static void test_cache_inodes()
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 );
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";
@ -37,68 +35,16 @@ static void test_cache_inodes()
iso1 = iso_file_new(file1);
assert( !strcmp(iso1->path, "/tmp/filename") );
CU_ASSERT_STRING_EQUAL(iso1->path, "/tmp/filename");
//TODO
free( file1 );
printf("\tOK\n");
}
void test_file_hashtable()
void add_file_hashtable_suite()
{
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();
CU_pSuite pSuite = CU_add_suite("FileHashtableSuite", NULL, NULL);
CU_add_test(pSuite, "test of cache_inodes", test_cache_inodes);
}