修复了fmemopen()不存在的问题

This commit is contained in:
lcw 2024-02-04 19:15:32 +08:00
parent 6b0875ee34
commit 104452c2d3
3 changed files with 11 additions and 5 deletions

1
.gitignore vendored
View File

@ -19,3 +19,4 @@ node_modules
# Xmake
.xmake
*.tmp

View File

@ -3,6 +3,7 @@
#include "test/u.hpp"
#include <tuple>
#include <cstdint>
#include <cstdio>
inline namespace {
@ -36,12 +37,16 @@ AddTestCase _(20, "ProcedureManager", [](TestCase& t) {
0x01, 0x00, 0x00, 0x00,
};
unsigned char obuf[256];
FILE *in = fopen(".in.tmp", "wb");
fwrite(ibuf, 128, 1, in);
fclose(in);
in = fopen(".in.tmp", "rb");
FILE *out = fopen(".out.tmp", "wb");
FILE *in = fmemopen(ibuf, 256, "r"),
*out = fmemopen(obuf, 256, "w");
pm.handleCall(in, out);
pm.handleCall(in, out);
fclose(in);
fclose(out);
return x;
}, 1);
});

View File

@ -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")