build: Refactor ImHexAPI into multiple separate files

This commit is contained in:
WerWolv
2025-08-14 20:16:40 +02:00
parent 4ca429e389
commit d920718b44
144 changed files with 1211 additions and 1067 deletions

View File

@@ -3,6 +3,7 @@
#include <hex/api/plugin_manager.hpp>
#include <content/views/view_patches.hpp>
#include <hex/api/task_manager.hpp>
#include <hex/api/imhex_api/provider.hpp>
using namespace hex;
using namespace hex::plugin::builtin;
@@ -10,22 +11,22 @@ using namespace hex::plugin::builtin;
TEST_SEQUENCE("Providers/ReadWrite") {
INIT_PLUGIN("Built-in");
auto &pr = *ImHexApi::Provider::createProvider("hex.builtin.provider.mem_file", true);
auto &provider = *ImHexApi::Provider::createProvider("hex.builtin.provider.mem_file", true);
TEST_ASSERT(pr.getSize() == 0);
TEST_ASSERT(!pr.isDirty());
TEST_ASSERT(provider.getSize() == 0);
TEST_ASSERT(!provider.isDirty());
pr.resize(50);
TEST_ASSERT(pr.getSize() == 50);
TEST_ASSERT(pr.isDirty());
provider.resize(50);
TEST_ASSERT(provider.getSize() == 50);
TEST_ASSERT(provider.isDirty());
char buf[] = "\x99\x99"; // temporary value that should be overwriten
pr.read(0, buf, 2);
provider.read(0, buf, 2);
TEST_ASSERT(std::equal(buf, buf+2, "\x00\x00"));
pr.write(0, "\xFF\xFF", 2);
provider.write(0, "\xFF\xFF", 2);
char buf2[] = "\x99\x99"; // temporary value that should be overwriten
pr.read(0, buf2, 2);
provider.read(0, buf2, 2);
TEST_ASSERT(std::equal(buf2, buf2+2, "\xFF\xFF"));
TEST_SUCCESS();