use nix build & meson & zlog

This commit is contained in:
Rongsong Shen 2025-11-03 18:19:59 +08:00
parent 0123623742
commit 346768a144
60 changed files with 13739 additions and 0 deletions

View file

@ -0,0 +1,52 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "unity.h"
#include "htab.h"
static htab_t htab;
uint64_t key = (uint64_t)0xfabcde6666666666;
static void test_ht_add_string(void) {
hent_t *e = NULL;
e = ht_add(&(htab), (void *)key);
TEST_ASSERT_NOT_NULL(e);
return;
}
static void test_ht_get_string(void) {
hent_t *e = NULL;
e = ht_get(&htab, (void *)key);
TEST_ASSERT_NOT_NULL(e);
TEST_ASSERT_TRUE((uint64_t)e->key == (uint64_t)key);
return;
}
static void test_ht_del_string(void) {
hent_t *e = NULL;
ht_del(&htab, (void *)key);
e = ht_get(&htab, (void *)key);
TEST_ASSERT_TRUE( e == NULL);
return;
}
void test_ht_int(void) {
printf("\n>> htab test int\n\n");
ht_init(&htab, 13, int_hash_key);
RUN_TEST(test_ht_add_string);
RUN_TEST(test_ht_get_string);
RUN_TEST(test_ht_del_string);
}