📄 test_ckhash.c
字号:
#include <stdio.h>#include "CKHash.h"#define MIN_TAB_SIZE 4int main( int argc, char *argv[] ){ int i; char *c[10] = { "apple", "banana", "banter", "baseball", "blueberry", "brown", "browser", "camera", "can", "cantaloupe" }; Dict *D = ckh_construct_dict( MIN_TAB_SIZE ); printf( "\nTest ``insert'' function\n" ); for( i = 0; i < 10; i++ ) printf( "ckh_insert( %s, %d ) (%d)\n", c[ i ], i, ckh_insert( D, c[ i ], i ) ); printf( "Current data size = %d, table size = %d\n", D->size, D->table_size ); printf( "\nTest ``lookup'' function\n" ); printf( "\tckh_lookup: %s (%d)\n", c[ 1 ], ckh_lookup( D, c[ 1 ] ) ); printf( "\tckh_lookup: %s (%d)\n", "cherry", ckh_lookup( D, "cherry" ) ); printf( "\nTest ``get'' function\n" ); printf( "\tckh_get: %s (%d)\n", c[ 1 ], ckh_get( D, c[ 1 ] ) ); printf( "\tckh_get: %s (%d)\n", "cherry", ckh_get( D, "cherry" ) ); printf( "\nTest ``increase value'' function\n" ); printf( "\tckh_increase_value: %s (%d)\n", c[ 1 ], ckh_increase_value( D, c[ 1 ] ) ); printf( "\tckh_get: %s (%d)\n", c[ 1 ], ckh_get( D, c[ 1 ] ) ); printf( "\nTest ``delete'' function\n" ); printf( "\tckh_delete: %s (%d)\n", "cherry", ckh_delete( D, "cherry" ) ); for( i = 0; i < 10; i++ ) printf( "\tckh_delete: %s (%d)\n", c[ i ], ckh_delete( D, c[ i ] ) ); printf( "Current data size = %d, table size = %d\n\n", D->size, D->table_size ); ckh_destruct_dict( D ); return( 0 );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -