From 104452c2d367f54a13a32cd9c89b971452e48639 Mon Sep 17 00:00:00 2001 From: lcw Date: Sun, 4 Feb 2024 19:15:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86fmemopen()=E4=B8=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + processor/test/cases/pmanager.cpp | 13 +++++++++---- processor/xmake.lua | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8274b1f..7768f3c 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ node_modules # Xmake .xmake +*.tmp \ No newline at end of file diff --git a/processor/test/cases/pmanager.cpp b/processor/test/cases/pmanager.cpp index d1afebc..ced1929 100644 --- a/processor/test/cases/pmanager.cpp +++ b/processor/test/cases/pmanager.cpp @@ -3,6 +3,7 @@ #include "test/u.hpp" #include #include +#include inline namespace { @@ -36,12 +37,16 @@ AddTestCase _(20, "ProcedureManager", [](TestCase& t) { 0x01, 0x00, 0x00, 0x00, }; - unsigned char obuf[256]; - - FILE *in = fmemopen(ibuf, 256, "r"), - *out = fmemopen(obuf, 256, "w"); + FILE *in = fopen(".in.tmp", "wb"); + fwrite(ibuf, 128, 1, in); + fclose(in); + in = fopen(".in.tmp", "rb"); + FILE *out = fopen(".out.tmp", "wb"); + pm.handleCall(in, out); pm.handleCall(in, out); + fclose(in); + fclose(out); return x; }, 1); }); diff --git a/processor/xmake.lua b/processor/xmake.lua index 855169e..43918c9 100644 --- a/processor/xmake.lua +++ b/processor/xmake.lua @@ -4,7 +4,7 @@ set_version("0.1.0") set_languages("c++20") set_targetdir("build") -add_includedirs(".") +add_includedirs(".", "pc", "utility") add_files("pc/*.cpp", "utility/*.cpp") target("main")