OCT 1.增加add接口规范 2.修正测试代码中的未初始化

This commit is contained in:
dongwenze 2023-04-03 09:55:01 +08:00
parent 760a6eb14a
commit f55b4b5647
3 changed files with 10 additions and 4 deletions

View File

@ -55,8 +55,12 @@ typedef struct {
static JSON_POST_CTX g_add_msg[] = { static JSON_POST_CTX g_add_msg[] = {
{R"({"type":"object","required":["rangeSet"]})", "Missing required field [rangeSet]"}, {R"({"type":"object","required":["rangeSet"]})", "Missing required field [rangeSet]"},
{R"({"properties":{"rangeSet":{"type":"array","minItems":1}}})", "No content in field [rangeSet]"}, {R"({"properties":{"rangeSet":{"type":"array","minItems":1}}})", "No content in array [rangeSet]"},
{R"({"properties":{"rangeSet":{"items":{"type":"object","required":["dhcpRange"]}}}})", "Missing required field [dhcpRange]"}, {R"({"properties":{"rangeSet":{"items":{"type":"object","required":["dhcpRange"]}}}})", "Missing required field [dhcpRange]"},
{R"({"properties":{"rangeSet":{"items":{"properties":{"netmask":{"type":"string"}}}}}})", "[netmask] should be a string value"},
{R"({"properties":{"rangeSet":{"items":{"properties":{"domainServer":{"type":"string"}}}}}})", "[domainServer] should be a string value"},
{R"({"properties":{"rangeSet":{"items":{"properties":{"gateway":{"type":"string"}}}}}})", "[gateway] should be a string value"},
{R"({"properties":{"rangeSet":{"items":{"properties":{"leaseTime":{"type":"integer"}}}}}})", "[leaseTime] should be an integer value"},
// {R"({"properties":{"rangeSet":{"items":{"properties":{"dhcpRange":{"type":"string","minLength":15}}}}}})", "Error in field [dhcpRange]"} // {R"({"properties":{"rangeSet":{"items":{"properties":{"dhcpRange":{"type":"string","minLength":15}}}}}})", "Error in field [dhcpRange]"}
}; };

View File

@ -8,7 +8,7 @@
TEST_SUITE("Hardware functions") { TEST_SUITE("Hardware functions") {
TEST_CASE("CPU") { TEST_CASE("CPU") {
PCPU_INFO cpuInfo; PCPU_INFO cpuInfo;
memset(cpuInfo, 0, sizeof(CPU_INFO)); memset(&cpuInfo, 0, sizeof(PCPU_INFO));
cpu_watch_init(); cpu_watch_init();

View File

@ -18,6 +18,7 @@ TEST_SUITE("UTArray") {
TEST_CASE("PUSH") { TEST_CASE("PUSH") {
PCOMBO p_combo; PCOMBO p_combo;
memset(&p_combo, 0, sizeof(PCOMBO));
utarray_new(nums, &ut_combo_icd); utarray_new(nums, &ut_combo_icd);
@ -37,6 +38,7 @@ TEST_SUITE("UTArray") {
TEST_CASE("POP") { TEST_CASE("POP") {
PCOMBO p_combo; PCOMBO p_combo;
memset(&p_combo, 0, sizeof(PCOMBO));
MESSAGE("original len: ", utarray_len(nums)); MESSAGE("original len: ", utarray_len(nums));
while(utarray_len(nums) != 0) { while(utarray_len(nums) != 0) {
p_combo = (PCOMBO)utarray_next(nums, p_combo); p_combo = (PCOMBO)utarray_next(nums, p_combo);