libisofs-legacy/test/test_exclude.c

34 lines
915 B
C
Raw Permalink Normal View History

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>
static void test_exclude()
2007-06-01 12:57:09 +00:00
{
struct iso_hash_table table = { {0,}, 0};
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");
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");
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);
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/dir") );
CU_ASSERT_FALSE( iso_exclude_lookup(&table, "/otherdir") );
2007-06-01 12:57:09 +00:00
}
void add_exclude_suite()
2007-06-01 12:57:09 +00:00
{
CU_pSuite pSuite = CU_add_suite("ExcludeSuite", NULL, NULL);
2007-06-01 12:57:09 +00:00
CU_add_test(pSuite, "test of exclude", test_exclude);
2007-06-01 12:57:09 +00:00
}