2007-06-01 12:57:09 +00:00
|
|
|
/*
|
|
|
|
* Unit test for exclude.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "exclude.h"
|
|
|
|
#include "test.h"
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2007-06-21 11:19:11 +00:00
|
|
|
static void test_exclude()
|
2007-06-01 12:57:09 +00:00
|
|
|
{
|
|
|
|
struct iso_hash_table table = { {0,}, 0};
|
2007-06-21 11:19:11 +00:00
|
|
|
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/dir") );
|
|
|
|
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/otherdir") );
|
2007-06-01 12:57:09 +00:00
|
|
|
iso_exclude_add_path(&table, "/otherdir");
|
2007-06-21 11:19:11 +00:00
|
|
|
CU_ASSERT_TRUE( iso_exclude_lookup(&table, "/otherdir") );
|
|
|
|
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/dir") );
|
2007-06-01 12:57:09 +00:00
|
|
|
iso_exclude_add_path(&table, "/dir");
|
2007-06-21 11:19:11 +00:00
|
|
|
CU_ASSERT_TRUE( iso_exclude_lookup(&table, "/otherdir") );
|
|
|
|
CU_ASSERT_TRUE( iso_exclude_lookup(&table, "/dir") );
|
2007-06-01 12:57:09 +00:00
|
|
|
iso_exclude_empty(&table);
|
2007-06-21 11:19:11 +00:00
|
|
|
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/dir") );
|
|
|
|
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/otherdir") );
|
2007-06-01 12:57:09 +00:00
|
|
|
}
|
|
|
|
|
2007-06-21 11:19:11 +00:00
|
|
|
void add_exclude_suite()
|
2007-06-01 12:57:09 +00:00
|
|
|
{
|
2007-06-21 11:19:11 +00:00
|
|
|
CU_pSuite pSuite = CU_add_suite("ExcludeSuite", NULL, NULL);
|
2007-06-01 12:57:09 +00:00
|
|
|
|
2007-06-21 11:19:11 +00:00
|
|
|
CU_add_test(pSuite, "test of exclude", test_exclude);
|
2007-06-01 12:57:09 +00:00
|
|
|
}
|