From b016924634a103e45f17826dde6b0e0dfc34735c Mon Sep 17 00:00:00 2001 From: pikastech Date: Thu, 2 Jun 2022 16:34:30 +0800 Subject: [PATCH] add cJSON-test.cpp --- port/linux/package/pikascript/cJSON.pyi | 2 +- .../pikascript/pikascript-lib/cJSON/cJSON_cJSON.c | 5 +++-- port/linux/test/cJSON-test.cpp | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 port/linux/test/cJSON-test.cpp diff --git a/port/linux/package/pikascript/cJSON.pyi b/port/linux/package/pikascript/cJSON.pyi index 9d9aa7670..6ea07731f 100644 --- a/port/linux/package/pikascript/cJSON.pyi +++ b/port/linux/package/pikascript/cJSON.pyi @@ -6,4 +6,4 @@ import json class cJSON(TinyObj): def __init__(self): ... def print(self) -> str: ... - def parse(self, val: str) -> any: ... + def parse(self, value: str) -> any: ... diff --git a/port/linux/package/pikascript/pikascript-lib/cJSON/cJSON_cJSON.c b/port/linux/package/pikascript/pikascript-lib/cJSON/cJSON_cJSON.c index de7dc1769..6fbba516c 100644 --- a/port/linux/package/pikascript/pikascript-lib/cJSON/cJSON_cJSON.c +++ b/port/linux/package/pikascript/pikascript-lib/cJSON/cJSON_cJSON.c @@ -1,8 +1,9 @@ #include "cJSON_cJSON.h" +#include "cJSON.h" void cJSON_cJSON___init__(PikaObj* self) {} -Arg* cJSON_cJSON_parse(PikaObj* self, char* val) { - return NULL; +Arg* cJSON_cJSON_parse(PikaObj* self, char* value) { + cJSON* cJSON_struct = cJSON_Parse(value); } char* cJSON_cJSON_print(PikaObj* self) { return NULL; diff --git a/port/linux/test/cJSON-test.cpp b/port/linux/test/cJSON-test.cpp new file mode 100644 index 000000000..d0c553d74 --- /dev/null +++ b/port/linux/test/cJSON-test.cpp @@ -0,0 +1,15 @@ +#include "gtest/gtest.h" +#include "test_common.h" +extern "C" { +#include "PikaMain.h" +#include "PikaParser.h" +#include "PikaStdLib_MemChecker.h" +#include "PikaVM.h" +#include "dataArgs.h" +#include "dataMemory.h" +#include "dataStrs.h" +#include "pikaScript.h" +#include "pika_config_gtest.h" +} + +extern PikaMemInfo pikaMemInfo; \ No newline at end of file