From f55b4b56475a283e9b309f1d748472f0cfb5a606 Mon Sep 17 00:00:00 2001 From: dongwenze Date: Mon, 3 Apr 2023 09:55:01 +0800 Subject: [PATCH] =?UTF-8?q?OCT=201.=E5=A2=9E=E5=8A=A0add=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=A7=84=E8=8C=83=202.=E4=BF=AE=E6=AD=A3=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B8=AD=E7=9A=84=E6=9C=AA=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- srcs/opendhcp183/query.cpp | 10 +++++++--- unit_test/hardware/hardware_test.cpp | 2 +- unit_test/uthash/utarray_test.cpp | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/srcs/opendhcp183/query.cpp b/srcs/opendhcp183/query.cpp index b95c5a3..103cda4 100644 --- a/srcs/opendhcp183/query.cpp +++ b/srcs/opendhcp183/query.cpp @@ -54,9 +54,13 @@ typedef struct { } JSON_POST_CTX; static JSON_POST_CTX g_add_msg[] = { - {R"({"type":"object","required":["rangeSet"]})", "Missing required field [rangeSet]"}, - {R"({"properties":{"rangeSet":{"type":"array","minItems":1}}})", "No content in field [rangeSet]"}, - {R"({"properties":{"rangeSet":{"items":{"type":"object","required":["dhcpRange"]}}}})", "Missing required field [dhcpRange]"}, + {R"({"type":"object","required":["rangeSet"]})", "Missing required 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":{"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]"} }; diff --git a/unit_test/hardware/hardware_test.cpp b/unit_test/hardware/hardware_test.cpp index 612c2fc..3df6ba9 100644 --- a/unit_test/hardware/hardware_test.cpp +++ b/unit_test/hardware/hardware_test.cpp @@ -8,7 +8,7 @@ TEST_SUITE("Hardware functions") { TEST_CASE("CPU") { PCPU_INFO cpuInfo; - memset(cpuInfo, 0, sizeof(CPU_INFO)); + memset(&cpuInfo, 0, sizeof(PCPU_INFO)); cpu_watch_init(); diff --git a/unit_test/uthash/utarray_test.cpp b/unit_test/uthash/utarray_test.cpp index 89e358a..be26e9b 100644 --- a/unit_test/uthash/utarray_test.cpp +++ b/unit_test/uthash/utarray_test.cpp @@ -18,6 +18,7 @@ TEST_SUITE("UTArray") { TEST_CASE("PUSH") { PCOMBO p_combo; + memset(&p_combo, 0, sizeof(PCOMBO)); utarray_new(nums, &ut_combo_icd); @@ -37,6 +38,7 @@ TEST_SUITE("UTArray") { TEST_CASE("POP") { PCOMBO p_combo; + memset(&p_combo, 0, sizeof(PCOMBO)); MESSAGE("original len: ", utarray_len(nums)); while(utarray_len(nums) != 0) { p_combo = (PCOMBO)utarray_next(nums, p_combo);