mirror of
https://github.com/openharmony/developtools_syscap_codec.git
synced 2026-08-27 02:11:19 -04:00
@@ -16,7 +16,7 @@
|
||||
#ifndef _SYSCAP_TOOL_H
|
||||
#define _SYSCAP_TOOL_H
|
||||
|
||||
#include "stdint.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define TYPE_FILE (0U)
|
||||
#define TYPE_STRING (1U)
|
||||
|
||||
@@ -13,10 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <securec.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -13,11 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
#include <securec.h>
|
||||
#include <cstdint>
|
||||
#include "hilog/log.h"
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <securec.h>
|
||||
#include "napi/native_api.h"
|
||||
#include "napi/native_node_api.h"
|
||||
#include "syscap_interface.h"
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <libgen.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "securec.h"
|
||||
#include "cJSON.h"
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
#include "endian_internal.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define B_L_SWAP16(A) ((((uint16_t)(A) & 0xff00) >> 8) | (((uint16_t)(A) & 0x00ff) << 8))
|
||||
#define B_L_SWAP32(A) ((((uint32_t)(A) & 0xff000000) >> 24) | (((uint32_t)(A) & 0x00ff0000) >> 8) | \
|
||||
|
||||
@@ -14,15 +14,11 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <libgen.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "securec.h"
|
||||
#include "endian_internal.h"
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
#ifndef _SYSCAP_CODEC_TEST_H
|
||||
#define _SYSCAP_CODEC_TEST_H
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <cstddef>
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstdlib>
|
||||
#include "syscap_interface.h"
|
||||
#include "syscap_codec_test.h"
|
||||
|
||||
@@ -45,7 +46,7 @@ HWTEST_F(SyscapCodecTest, EncodeOsSyscap, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(SyscapCodecTest, EncodePrivateSyscap, TestSize.Level1)
|
||||
{
|
||||
char *charPriInput = NULL;
|
||||
char *charPriInput = nullptr;
|
||||
int priOutLen;
|
||||
EXPECT_TRUE(EncodePrivateSyscap(&charPriInput, &priOutLen));
|
||||
free(charPriInput);
|
||||
@@ -59,7 +60,7 @@ HWTEST_F(SyscapCodecTest, EncodePrivateSyscap, TestSize.Level1)
|
||||
HWTEST_F(SyscapCodecTest, DecodeOsSyscap, TestSize.Level1)
|
||||
{
|
||||
int osSyscap[32] = {1, 3, 3};
|
||||
char (*osOutput)[SINGLE_SYSCAP_LEN] = NULL;
|
||||
char (*osOutput)[SINGLE_SYSCAP_LEN] = nullptr;
|
||||
int decodeOsCnt;
|
||||
char expectOsOutput001[] = "SystemCapability.Account.AppAccount";
|
||||
char expectOsOutput002[] = "SystemCapability.Account.OsAccount";
|
||||
@@ -78,7 +79,7 @@ HWTEST_F(SyscapCodecTest, DecodeOsSyscap, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(SyscapCodecTest, DecodePrivateSyscap, TestSize.Level1)
|
||||
{
|
||||
char (*priOutput)[SINGLE_SYSCAP_LEN] = NULL;
|
||||
char (*priOutput)[SINGLE_SYSCAP_LEN] = nullptr;
|
||||
char priSyscap[] = "Device.syscap1GEDR,Device.syscap2WREGW,Vendor.syscap3RGD,Vendor.syscap4RWEG,Vendor.syscap5REWGWE,";
|
||||
int decodePriCnt;
|
||||
char expectPriOutput001[] = "SystemCapability.Device.syscap1GEDR";
|
||||
@@ -104,15 +105,15 @@ HWTEST_F(SyscapCodecTest, DecodePrivateSyscap, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(SyscapCodecTest, DecodePrivateSyscap1, TestSize.Level1)
|
||||
{
|
||||
char *charPriInput = NULL;
|
||||
char (*priOutput)[SINGLE_SYSCAP_LEN] = NULL;
|
||||
char *charPriInput = nullptr;
|
||||
char (*priOutput)[SINGLE_SYSCAP_LEN] = nullptr;
|
||||
int priOutLen;
|
||||
int decodePriCnt;
|
||||
|
||||
EXPECT_TRUE(EncodePrivateSyscap(&charPriInput, &priOutLen));
|
||||
if (priOutLen == 0) {
|
||||
EXPECT_TRUE(DecodePrivateSyscap(charPriInput, &priOutput, &decodePriCnt));
|
||||
EXPECT_EQ((void *)priOutput, (void *)NULL);
|
||||
EXPECT_EQ((void *)priOutput, (void *)nullptr);
|
||||
EXPECT_EQ(decodePriCnt, 0);
|
||||
free(priOutput);
|
||||
}
|
||||
@@ -148,7 +149,7 @@ HWTEST_F(SyscapCodecTest, ComparePcidString, TestSize.Level1)
|
||||
EXPECT_EQ(result.targetApiVersion, 0);
|
||||
EXPECT_EQ(result.missSyscapNum, 0);
|
||||
for (int i = 0; i < MAX_MISS_SYSCAP; i++) {
|
||||
EXPECT_EQ((void *)result.syscap[i], (void *)NULL);
|
||||
EXPECT_EQ((void *)result.syscap[i], (void *)nullptr);
|
||||
}
|
||||
}
|
||||
} // namespace Syscap
|
||||
|
||||
Reference in New Issue
Block a user