update controller code
This commit is contained in:
parent
2836d196da
commit
41f56fa6ed
54 changed files with 9688 additions and 214 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <unity/unity.h>
|
||||
|
||||
#include "htab.h"
|
||||
|
|
@ -10,42 +10,46 @@ static htab_t htab;
|
|||
|
||||
uint64_t key = (uint64_t)0xfabcde6666666666;
|
||||
|
||||
static void test_ht_add_string(void) {
|
||||
hent_t *e = NULL;
|
||||
static void test_ht_add_string(void)
|
||||
{
|
||||
hent_t* e = NULL;
|
||||
|
||||
e = ht_add(&(htab), (void *)key);
|
||||
e = ht_add(&(htab), (void*)key);
|
||||
TEST_ASSERT_NOT_NULL(e);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void test_ht_get_string(void) {
|
||||
hent_t *e = NULL;
|
||||
static void test_ht_get_string(void)
|
||||
{
|
||||
hent_t* e = NULL;
|
||||
|
||||
e = ht_get(&htab, (void *)key);
|
||||
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);
|
||||
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);
|
||||
|
||||
e = ht_get(&htab, (void *)key);
|
||||
TEST_ASSERT_TRUE( e == NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void test_ht_int(void) {
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue