feat(lib): 添加哈希表实现及相关测试功能

🐛 fix(main): 修改OLED显示位置和配置
📝 docs(demo/list/test.c): 更新测试文件,添加哈希表测试用例
This commit is contained in:
JiXieShi
2024-12-16 23:40:13 +08:00
parent 3709d3d284
commit 23116b7e3d
7 changed files with 240 additions and 7 deletions

View File

@@ -8,4 +8,6 @@
extern int Test_List(void *pVoid);
extern int Test_Queue(void *pVoid1);
extern int Test_Hash(void* pVoid);
#endif //HW_LIB_T_LIST_H

View File

@@ -3,6 +3,7 @@
#include "list.h"
#include "queue.h"
#include "hash_table.h"
typedef struct test {
int val1;
@@ -100,6 +101,7 @@ int Test_List(void *pVoid) {
// 测试销毁操作
printf("-----destroy----\n");
list_destroy(&list, NULL); // 销毁链表
return 0;
}
int Test_Queue(void *pVoid) {
@@ -141,4 +143,16 @@ int Test_Queue(void *pVoid) {
printf("Pop value from front: %d\n", *popVal);
}
delQueue_List(deque);
return 0;
}
int Test_Hash(void* pVoid) {
Hash_Table_t* ht = ht_new();
ht_insert(ht, "name", "lydxh");
ht_insert(ht, "age", "18");
printf("Name:%s\nAge:%s", ht_search(ht, "name"), ht_search(ht, "age"));
ht_delete(ht, "name");
ht_delete(ht, "age");
ht_del_hash_table(ht);
return 0;
}