Ai
9 Star 76 Fork 19

TencentOS/TencentOS-tiny

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
suit_binary_heap.c 17.98 KB
一键复制 编辑 原始数据 按行查看 历史
daishengdong 提交于 2019-10-29 16:57 +08:00 . add a set of dyn(create / destroy) interface
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "test/test.h"
#include "greatest/greatest.h"
SUITE(suit_binary_heap);
k_bin_heap_t test_bin_heap_00;
k_bin_heap_t test_bin_heap_01;
#define TEST_BIN_HEAP_ITEM_CNT 16
uint8_t test_bin_heap_pool_00[sizeof(test_bin_heap_item_t) * TEST_BIN_HEAP_ITEM_CNT];
uint8_t test_bin_heap_pool_01[sizeof(test_bin_heap_item_t) * TEST_BIN_HEAP_ITEM_CNT];
uint8_t test_bin_heap_int_pool_00[sizeof(int) * TEST_BIN_HEAP_ITEM_CNT];
uint8_t test_bin_heap_int_pool_01[sizeof(int) * TEST_BIN_HEAP_ITEM_CNT];
int test_bin_heap_cmp_dummy(void *first, void *second)
{
return 0;
}
int test_bin_heap_min_cmp_dummy(void *first, void *second)
{
test_bin_heap_item_t *item_first, *item_second;
item_first = (test_bin_heap_item_t *)first;
item_second = (test_bin_heap_item_t *)second;
if (item_first->a < item_second->a) {
return K_TRUE;
}
return K_FALSE;
}
int test_bin_heap_max_cmp_dummy(void *first, void *second)
{
test_bin_heap_item_t *item_first, *item_second;
item_first = (test_bin_heap_item_t *)first;
item_second = (test_bin_heap_item_t *)second;
if (item_first->a > item_second->a) {
return K_TRUE;
}
return K_FALSE;
}
int test_bin_heap_min_int_cmp_dummy(void *first, void *second)
{
int *item_first, *item_second;
item_first = (int *)first;
item_second = (int *)second;
if (*item_first < *item_second) {
return K_TRUE;
}
return K_FALSE;
}
int test_bin_heap_max_int_cmp_dummy(void *first, void *second)
{
int *item_first, *item_second;
item_first = (int *)first;
item_second = (int *)second;
if (*item_first > *item_second) {
return K_TRUE;
}
return K_FALSE;
}
TEST test_tos_binary_heap_create(void)
{
k_err_t err;
err = tos_bin_heap_create(&test_bin_heap_00, test_bin_heap_pool_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(test_bin_heap_item_t), K_NULL);
ASSERT_EQ(err, K_ERR_OBJ_PTR_NULL);
err = tos_bin_heap_create(K_NULL, test_bin_heap_pool_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(test_bin_heap_item_t), test_bin_heap_cmp_dummy);
ASSERT_EQ(err, K_ERR_OBJ_PTR_NULL);
err = tos_bin_heap_create(&test_bin_heap_00, test_bin_heap_pool_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(test_bin_heap_item_t), test_bin_heap_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
err = tos_bin_heap_create(&test_bin_heap_01, test_bin_heap_pool_01, TEST_BIN_HEAP_ITEM_CNT, sizeof(test_bin_heap_item_t), test_bin_heap_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
err = tos_bin_heap_destroy(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
err = tos_bin_heap_destroy(&test_bin_heap_01);
ASSERT_EQ(err, K_ERR_NONE);
PASS();
}
TEST test_tos_binary_heap_destroy(void)
{
k_err_t err;
#if TOS_CFG_OBJECT_VERIFY_EN > 0u
err = tos_bin_heap_destroy(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_OBJ_INVALID);
#endif
err = tos_bin_heap_destroy(K_NULL);
ASSERT_EQ(err, K_ERR_OBJ_PTR_NULL);
PASS();
}
TEST test_tos_binary_heap_min_push(void)
{
k_err_t err;
int i = 0;
test_bin_heap_item_t items[TEST_BIN_HEAP_ITEM_CNT] = {
{ 2, "222", '2' },
{ 4, "444", '4' },
{ 1, "111", '1' },
{ 7, "777", '7' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 2, "222", '2' },
{ 0, "000", '0' },
{ 9, "999", '9' },
{ 10, "aaa", 'a' },
{ 5, "555", '5' },
{ 12, "ccc", 'c' },
{ 11, "bbb", 'b' },
{ 3, "333", '3' },
{ 6, "666", '6' },
{ 8, "888", '8' },
};
test_bin_heap_item_t items_should[TEST_BIN_HEAP_ITEM_CNT] = {
{ 0, "000", '0' },
{ 1, "111", '1' },
{ 2, "222", '2' },
{ 2, "222", '2' },
{ 3, "333", '3' },
{ 4, "444", '4' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 6, "666", '6' },
{ 7, "777", '7' },
{ 8, "888", '8' },
{ 9, "999", '9' },
{ 10, "aaa", 'a' },
{ 11, "bbb", 'b' },
{ 12, "ccc", 'c' },
};
test_bin_heap_item_t item_popped;
size_t item_size;
// we gonna build a min heap
err = tos_bin_heap_create(&test_bin_heap_00, test_bin_heap_pool_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(test_bin_heap_item_t), test_bin_heap_min_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_push(&test_bin_heap_00, &items[i], sizeof(test_bin_heap_item_t));
ASSERT_EQ(err, K_ERR_NONE);
}
ASSERT(tos_bin_heap_is_full(&test_bin_heap_00));
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_pop(&test_bin_heap_00, &item_popped, &item_size);
ASSERT_EQ(err, K_ERR_NONE);
ASSERT_EQ(item_size, sizeof(test_bin_heap_item_t));
ASSERT_EQ(item_popped.a, items_should[i].a);
ASSERT_EQ(strcmp(item_popped.b, items_should[i].b), 0);
ASSERT_EQ(item_popped.c, items_should[i].c);
}
ASSERT(tos_bin_heap_is_empty(&test_bin_heap_00));
err = tos_bin_heap_destroy(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
PASS();
}
TEST test_tos_binary_heap_max_push(void)
{
k_err_t err;
int i = 0;
test_bin_heap_item_t items[TEST_BIN_HEAP_ITEM_CNT] = {
{ 2, "222", '2' },
{ 4, "444", '4' },
{ 1, "111", '1' },
{ 7, "777", '7' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 2, "222", '2' },
{ 0, "000", '0' },
{ 9, "999", '9' },
{ 10, "aaa", 'a' },
{ 5, "555", '5' },
{ 12, "ccc", 'c' },
{ 11, "bbb", 'b' },
{ 3, "333", '3' },
{ 6, "666", '6' },
{ 8, "888", '8' },
};
test_bin_heap_item_t items_should[TEST_BIN_HEAP_ITEM_CNT] = {
{ 12, "ccc", 'c' },
{ 11, "bbb", 'b' },
{ 10, "aaa", 'a' },
{ 9, "999", '9' },
{ 8, "888", '8' },
{ 7, "777", '7' },
{ 6, "666", '6' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 4, "444", '4' },
{ 3, "333", '3' },
{ 2, "222", '2' },
{ 2, "222", '2' },
{ 1, "111", '1' },
{ 0, "000", '0' },
};
test_bin_heap_item_t item_popped;
size_t item_size;
// we gonna build a max heap
err = tos_bin_heap_create(&test_bin_heap_00, test_bin_heap_pool_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(test_bin_heap_item_t), test_bin_heap_max_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_push(&test_bin_heap_00, &items[i], sizeof(test_bin_heap_item_t));
ASSERT_EQ(err, K_ERR_NONE);
}
ASSERT(tos_bin_heap_is_full(&test_bin_heap_00));
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_pop(&test_bin_heap_00, &item_popped, &item_size);
ASSERT_EQ(err, K_ERR_NONE);
ASSERT_EQ(item_size, sizeof(test_bin_heap_item_t));
ASSERT_EQ(item_popped.a, items_should[i].a);
ASSERT_EQ(strcmp(item_popped.b, items_should[i].b), 0);
ASSERT_EQ(item_popped.c, items_should[i].c);
}
ASSERT(tos_bin_heap_is_empty(&test_bin_heap_00));
err = tos_bin_heap_destroy(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
PASS();
}
TEST test_tos_binary_heap_max_push_dyn(void)
{
k_err_t err;
int i = 0;
test_bin_heap_item_t items[TEST_BIN_HEAP_ITEM_CNT] = {
{ 2, "222", '2' },
{ 4, "444", '4' },
{ 1, "111", '1' },
{ 7, "777", '7' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 2, "222", '2' },
{ 0, "000", '0' },
{ 9, "999", '9' },
{ 10, "aaa", 'a' },
{ 5, "555", '5' },
{ 12, "ccc", 'c' },
{ 11, "bbb", 'b' },
{ 3, "333", '3' },
{ 6, "666", '6' },
{ 8, "888", '8' },
};
test_bin_heap_item_t items_should[TEST_BIN_HEAP_ITEM_CNT] = {
{ 12, "ccc", 'c' },
{ 11, "bbb", 'b' },
{ 10, "aaa", 'a' },
{ 9, "999", '9' },
{ 8, "888", '8' },
{ 7, "777", '7' },
{ 6, "666", '6' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 4, "444", '4' },
{ 3, "333", '3' },
{ 2, "222", '2' },
{ 2, "222", '2' },
{ 1, "111", '1' },
{ 0, "000", '0' },
};
test_bin_heap_item_t item_popped;
size_t item_size;
// we gonna build a max heap
err = tos_bin_heap_create_dyn(&test_bin_heap_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(test_bin_heap_item_t), test_bin_heap_max_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_push(&test_bin_heap_00, &items[i], sizeof(test_bin_heap_item_t));
ASSERT_EQ(err, K_ERR_NONE);
}
ASSERT(tos_bin_heap_is_full(&test_bin_heap_00));
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_pop(&test_bin_heap_00, &item_popped, &item_size);
ASSERT_EQ(err, K_ERR_NONE);
ASSERT_EQ(item_size, sizeof(test_bin_heap_item_t));
ASSERT_EQ(item_popped.a, items_should[i].a);
ASSERT_EQ(strcmp(item_popped.b, items_should[i].b), 0);
ASSERT_EQ(item_popped.c, items_should[i].c);
}
ASSERT(tos_bin_heap_is_empty(&test_bin_heap_00));
err = tos_bin_heap_destroy_dyn(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
PASS();
}
TEST test_tos_binary_heap_min_int_push(void)
{
k_err_t err;
int i = 0;
int items[TEST_BIN_HEAP_ITEM_CNT] = {
2,
4,
1,
7,
5,
5,
2,
0,
9,
10,
5,
12,
11,
3,
6,
8,
};
int items_should[TEST_BIN_HEAP_ITEM_CNT] = {
0,
1,
2,
2,
3,
4,
5,
5,
5,
6,
7,
8,
9,
10,
11,
12,
};
int item_popped;
size_t item_size;
// we gonna build a min heap
err = tos_bin_heap_create(&test_bin_heap_00, test_bin_heap_int_pool_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(int), test_bin_heap_min_int_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_push(&test_bin_heap_00, &items[i], sizeof(int));
ASSERT_EQ(err, K_ERR_NONE);
}
ASSERT(tos_bin_heap_is_full(&test_bin_heap_00));
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_pop(&test_bin_heap_00, &item_popped, &item_size);
ASSERT_EQ(err, K_ERR_NONE);
ASSERT_EQ(item_size, sizeof(int));
ASSERT_EQ(item_popped, items_should[i]);
}
ASSERT(tos_bin_heap_is_empty(&test_bin_heap_00));
err = tos_bin_heap_destroy(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
PASS();
}
TEST test_tos_binary_heap_max_int_push(void)
{
k_err_t err;
int i = 0;
int items[TEST_BIN_HEAP_ITEM_CNT] = {
2,
4,
1,
7,
5,
5,
2,
0,
9,
10,
5,
12,
11,
3,
6,
8,
};
int items_should[TEST_BIN_HEAP_ITEM_CNT] = {
12,
11,
10,
9,
8,
7,
6,
5,
5,
5,
4,
3,
2,
2,
1,
0,
};
int item_popped;
size_t item_size;
// we gonna build a max heap
err = tos_bin_heap_create(&test_bin_heap_00, test_bin_heap_int_pool_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(int), test_bin_heap_max_int_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_push(&test_bin_heap_00, &items[i], sizeof(int));
ASSERT_EQ(err, K_ERR_NONE);
}
ASSERT(tos_bin_heap_is_full(&test_bin_heap_00));
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_pop(&test_bin_heap_00, &item_popped, &item_size);
ASSERT_EQ(err, K_ERR_NONE);
ASSERT_EQ(item_size, sizeof(int));
ASSERT_EQ(item_popped, items_should[i]);
}
ASSERT(tos_bin_heap_is_empty(&test_bin_heap_00));
err = tos_bin_heap_destroy(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
PASS();
}
TEST test_tos_binary_heap_max_int_push_dyn(void)
{
k_err_t err;
int i = 0;
int items[TEST_BIN_HEAP_ITEM_CNT] = {
2,
4,
1,
7,
5,
5,
2,
0,
9,
10,
5,
12,
11,
3,
6,
8,
};
int items_should[TEST_BIN_HEAP_ITEM_CNT] = {
12,
11,
10,
9,
8,
7,
6,
5,
5,
5,
4,
3,
2,
2,
1,
0,
};
int item_popped;
size_t item_size;
// we gonna build a max heap
err = tos_bin_heap_create_dyn(&test_bin_heap_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(int), test_bin_heap_max_int_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_push(&test_bin_heap_00, &items[i], sizeof(int));
ASSERT_EQ(err, K_ERR_NONE);
}
ASSERT(tos_bin_heap_is_full(&test_bin_heap_00));
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_pop(&test_bin_heap_00, &item_popped, &item_size);
ASSERT_EQ(err, K_ERR_NONE);
ASSERT_EQ(item_size, sizeof(int));
ASSERT_EQ(item_popped, items_should[i]);
}
ASSERT(tos_bin_heap_is_empty(&test_bin_heap_00));
err = tos_bin_heap_destroy_dyn(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
PASS();
}
TEST test_tos_binary_heap_push_limit(void)
{
k_err_t err;
int i = 0;
test_bin_heap_item_t items[TEST_BIN_HEAP_ITEM_CNT] = {
{ 2, "222", '2' },
{ 4, "444", '4' },
{ 1, "111", '1' },
{ 7, "777", '7' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 2, "222", '2' },
{ 0, "000", '0' },
{ 9, "999", '9' },
{ 10, "aaa", 'a' },
{ 5, "555", '5' },
{ 12, "ccc", 'c' },
{ 11, "bbb", 'b' },
{ 3, "333", '3' },
{ 6, "666", '6' },
{ 8, "888", '8' },
};
test_bin_heap_item_t items_should[TEST_BIN_HEAP_ITEM_CNT] = {
{ 12, "ccc", 'c' },
{ 11, "bbb", 'b' },
{ 10, "aaa", 'a' },
{ 9, "999", '9' },
{ 8, "888", '8' },
{ 7, "777", '7' },
{ 6, "666", '6' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 4, "444", '4' },
{ 3, "333", '3' },
{ 2, "222", '2' },
{ 2, "222", '2' },
{ 1, "111", '1' },
{ 0, "000", '0' },
};
test_bin_heap_item_t item_popped;
size_t item_size;
// we gonna build a max heap
err = tos_bin_heap_create(&test_bin_heap_00, test_bin_heap_pool_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(test_bin_heap_item_t), test_bin_heap_max_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_push(&test_bin_heap_00, &items[i], sizeof(test_bin_heap_item_t));
ASSERT_EQ(err, K_ERR_NONE);
}
ASSERT(tos_bin_heap_is_full(&test_bin_heap_00));
err = tos_bin_heap_push(&test_bin_heap_00, &items[0], sizeof(test_bin_heap_item_t));
ASSERT_EQ(err, K_ERR_BIN_HEAP_FULL);
ASSERT(tos_bin_heap_is_full(&test_bin_heap_00));
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_pop(&test_bin_heap_00, &item_popped, &item_size);
ASSERT_EQ(err, K_ERR_NONE);
ASSERT_EQ(item_size, sizeof(test_bin_heap_item_t));
ASSERT_EQ(item_popped.a, items_should[i].a);
ASSERT_EQ(strcmp(item_popped.b, items_should[i].b), 0);
ASSERT_EQ(item_popped.c, items_should[i].c);
}
ASSERT(tos_bin_heap_is_empty(&test_bin_heap_00));
err = tos_bin_heap_pop(&test_bin_heap_00, &item_popped, &item_size);
ASSERT_EQ(err, K_ERR_BIN_HEAP_EMPTY);
ASSERT(tos_bin_heap_is_empty(&test_bin_heap_00));
err = tos_bin_heap_destroy(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
PASS();
}
TEST test_tos_binary_flush(void)
{
k_err_t err;
int i = 0;
test_bin_heap_item_t items[TEST_BIN_HEAP_ITEM_CNT] = {
{ 2, "222", '2' },
{ 4, "444", '4' },
{ 1, "111", '1' },
{ 7, "777", '7' },
{ 5, "555", '5' },
{ 5, "555", '5' },
{ 2, "222", '2' },
{ 0, "000", '0' },
{ 9, "999", '9' },
{ 10, "aaa", 'a' },
{ 5, "555", '5' },
{ 12, "ccc", 'c' },
{ 11, "bbb", 'b' },
{ 3, "333", '3' },
{ 6, "666", '6' },
{ 8, "888", '8' },
};
test_bin_heap_item_t item_popped;
size_t item_size;
// we gonna build a max heap
err = tos_bin_heap_create(&test_bin_heap_00, test_bin_heap_pool_00, TEST_BIN_HEAP_ITEM_CNT, sizeof(test_bin_heap_item_t), test_bin_heap_max_cmp_dummy);
ASSERT_EQ(err, K_ERR_NONE);
for (i = 0; i < TEST_BIN_HEAP_ITEM_CNT; ++i) {
err = tos_bin_heap_push(&test_bin_heap_00, &items[i], sizeof(test_bin_heap_item_t));
ASSERT_EQ(err, K_ERR_NONE);
}
ASSERT(tos_bin_heap_is_full(&test_bin_heap_00));
err = tos_bin_heap_flush(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
ASSERT(tos_bin_heap_is_empty(&test_bin_heap_00));
err = tos_bin_heap_pop(&test_bin_heap_00, &item_popped, &item_size);
ASSERT_EQ(err, K_ERR_BIN_HEAP_EMPTY);
err = tos_bin_heap_push(&test_bin_heap_00, &item_popped, sizeof(test_bin_heap_item_t));
ASSERT_EQ(err, K_ERR_NONE);
err = tos_bin_heap_destroy(&test_bin_heap_00);
ASSERT_EQ(err, K_ERR_NONE);
PASS();
}
SUITE(suit_binary_heap)
{
RUN_TEST(test_tos_binary_heap_create);
RUN_TEST(test_tos_binary_heap_destroy);
RUN_TEST(test_tos_binary_heap_min_push);
RUN_TEST(test_tos_binary_heap_max_push);
RUN_TEST(test_tos_binary_heap_max_push_dyn);
RUN_TEST(test_tos_binary_heap_min_int_push);
RUN_TEST(test_tos_binary_heap_max_int_push);
RUN_TEST(test_tos_binary_heap_max_int_push_dyn);
RUN_TEST(test_tos_binary_heap_push_limit);
RUN_TEST(test_tos_binary_flush);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/TencentOS/TencentOS-tiny.git
git@gitee.com:TencentOS/TencentOS-tiny.git
TencentOS
TencentOS-tiny
TencentOS-tiny
master

搜索帮助