Implemented relaxed iso constraints & Cunit based unit-tests

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

View File

@ -9,50 +9,25 @@
#include <assert.h>
#include <stdio.h>
void test_exclude()
static void test_exclude()
{
struct iso_hash_table table = { {0,}, 0};
printf("Testing exclude hashtable...");
assert( !iso_exclude_lookup(&table, "/dir") );
assert( !iso_exclude_lookup(&table, "/otherdir") );
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/dir") );
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/otherdir") );
iso_exclude_add_path(&table, "/otherdir");
assert( iso_exclude_lookup(&table, "/otherdir") );
assert( !iso_exclude_lookup(&table, "/dir") );
CU_ASSERT_TRUE( iso_exclude_lookup(&table, "/otherdir") );
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/dir") );
iso_exclude_add_path(&table, "/dir");
assert( iso_exclude_lookup(&table, "/otherdir") );
assert( iso_exclude_lookup(&table, "/dir") );
CU_ASSERT_TRUE( iso_exclude_lookup(&table, "/otherdir") );
CU_ASSERT_TRUE( iso_exclude_lookup(&table, "/dir") );
iso_exclude_empty(&table);
assert( !iso_exclude_lookup(&table, "/dir") );
assert( !iso_exclude_lookup(&table, "/otherdir") );
printf("\tOK\n");
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/dir") );
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/otherdir") );
}
/*
* Unit test for exclude.h
*/
#include "exclude.h"
#include "test.h"
#include <assert.h>
#include <stdio.h>
void test_exclude()
void add_exclude_suite()
{
struct iso_hash_table table = { {0,}, 0};
CU_pSuite pSuite = CU_add_suite("ExcludeSuite", NULL, NULL);
printf("Testing exclude hashtable...");
assert( !iso_exclude_lookup(&table, "/dir") );
assert( !iso_exclude_lookup(&table, "/otherdir") );
iso_exclude_add_path(&table, "/otherdir");
assert( iso_exclude_lookup(&table, "/otherdir") );
assert( !iso_exclude_lookup(&table, "/dir") );
iso_exclude_add_path(&table, "/dir");
assert( iso_exclude_lookup(&table, "/otherdir") );
assert( iso_exclude_lookup(&table, "/dir") );
iso_exclude_empty(&table);
assert( !iso_exclude_lookup(&table, "/dir") );
assert( !iso_exclude_lookup(&table, "/otherdir") );
printf("\tOK\n");
CU_add_test(pSuite, "test of exclude", test_exclude);
}