ccnbtreetest.c File Reference

Part of ccnr - CCNx Repository Daemon. More...

Go to the source code of this file.

Defines

#define FAILIF(cond)   do {} while ((cond) && fatal(__func__, __LINE__))
#define CHKSYS(res)   FAILIF((res) == -1)
#define CHKPTR(p)   FAILIF((p) == NULL)

Functions

static int fatal (const char *fn, int lineno)
static int test_directory_creation (void)
 Use standard mkdtemp() to create a subdirectory of the current working directory, and set the TEST_DIRECTORY environment variable with its name.
static int test_btree_io (void)
 Basic tests of ccn_btree_io_from_directory() and its methods.
static void check_structure_size (const char *what, int sz)
 Helper for test_structure_sizes().
int test_structure_sizes (void)
 Helper for test_structure_sizes().
int test_btree_lockfile (void)
 Test that the lockfile works.
int test_btree_chknode (void)
int test_btree_key_fetch (void)
int test_btree_compare (void)
int test_btree_searchnode (void)
int test_btree_init (void)
struct ccn_btreeexample_btree_small (void)
int test_btree_lookup (void)
int test_basic_btree_insert_entry (void)
int test_btree_inserts_from_stdin (void)
int test_flatname (void)
static int testhelp_count_matches (struct ccn_btree *btree, unsigned char *msg, size_t size)
 Given an Interest (or a Name), find the matching objects.
int test_insert_content (void)
 Make an index from a file filled ccnb-encoded content objects.
int ccnbtreetest_main (int argc, char **argv)

Variables

struct node_example ex1
struct node_example ex2
struct root_example rootex1


Detailed Description

Part of ccnr - CCNx Repository Daemon.

Definition in file ccnbtreetest.c.


Define Documentation

#define CHKPTR (  )     FAILIF((p) == NULL)

#define CHKSYS ( res   )     FAILIF((res) == -1)

#define FAILIF ( cond   )     do {} while ((cond) && fatal(__func__, __LINE__))


Function Documentation

int ccnbtreetest_main ( int  argc,
char **  argv 
)

Definition at line 917 of file ccnbtreetest.c.

static void check_structure_size ( const char *  what,
int  sz 
) [static]

Helper for test_structure_sizes().

Prints out the size of the struct

Definition at line 147 of file ccnbtreetest.c.

Referenced by test_structure_sizes().

struct ccn_btree* example_btree_small ( void   )  [read]

Definition at line 422 of file ccnbtreetest.c.

Referenced by test_basic_btree_insert_entry(), and test_btree_lookup().

static int fatal ( const char *  fn,
int  lineno 
) [static]

Definition at line 46 of file ccnbtreetest.c.

int test_basic_btree_insert_entry ( void   ) 

Definition at line 493 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_btree_chknode ( void   ) 

Definition at line 243 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_btree_compare ( void   ) 

Definition at line 319 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_btree_init ( void   ) 

Definition at line 395 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_btree_inserts_from_stdin ( void   ) 

Definition at line 556 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

static int test_btree_io ( void   )  [static]

Basic tests of ccn_btree_io_from_directory() and its methods.

Assumes TEST_DIRECTORY has been set.

Definition at line 89 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_btree_key_fetch ( void   ) 

Definition at line 269 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_btree_lockfile ( void   ) 

Test that the lockfile works.

Definition at line 176 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_btree_lookup ( void   ) 

Definition at line 451 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_btree_searchnode ( void   ) 

Definition at line 349 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

static int test_directory_creation ( void   )  [static]

Use standard mkdtemp() to create a subdirectory of the current working directory, and set the TEST_DIRECTORY environment variable with its name.

Definition at line 61 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_flatname ( void   ) 

Definition at line 643 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_insert_content ( void   ) 

Make an index from a file filled ccnb-encoded content objects.

Intersprsed interests will be regarded as querys, and matches will be found.

The file is named by the environment varible TEST_CONTENT.

Definition at line 798 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

int test_structure_sizes ( void   ) 

Helper for test_structure_sizes().

Prints the size of important structures, and make sure that they are mutiples of CCN_BT_SIZE_UNITS.

Definition at line 161 of file ccnbtreetest.c.

Referenced by ccnbtreetest_main().

static int testhelp_count_matches ( struct ccn_btree btree,
unsigned char *  msg,
size_t  size 
) [static]

Given an Interest (or a Name), find the matching objects.

Returns:
count of matches, or -1 for an error.

Definition at line 728 of file ccnbtreetest.c.

Referenced by test_insert_content().


Variable Documentation

struct node_example ex1

struct node_example ex2

Initial value:

 {
    {{0x05, 0x3a, 0xde, 0x78}, {1}},
    "struthiomimus",
    {
        {.t={.koff1={0,0,0,2+8}, .ksiz1={0,3}, .entdx={0,0}, .entsz={3}}}, 
        {.t={.koff0={0,0,0,0+8}, .ksiz0={0,5}, .entdx={0,1}, .entsz={3}}}, 
        {.t={.koff0={0,0,0,1+8}, .ksiz0={0,5}, .entdx={0,2}, .entsz={3}}}, 
    }
}

Definition at line 216 of file ccnbtreetest.c.

struct root_example rootex1

Referenced by example_btree_small().


Generated on Thu Feb 16 00:44:24 2012 for Content-Centric Networking in C by  doxygen 1.5.6