aoc-2025/libguf/test/test_dict.hpp
2025-12-23 21:13:41 +01:00

36 lines
792 B
C++
Executable File

#pragma once
#include <vector>
#include <optional>
#include <string>
#include "test.hpp"
extern "C"
{
#include "impls/dbuf_impl.h"
#include "guf_alloc_libc.h"
}
struct DictSvToIntTest : public Test
{
DictSvToIntTest(const std::string& nm) : Test(nm)
{
allocator_ctx.zero_init = false;
guf_alloc_tracker_init(&allocator_ctx.tracker, 3, "DictSvToIntTest_allocator", NULL, NULL);
guf_libc_allocator_init(&allocator, &allocator_ctx);
};
void run() override;
private:
guf_allocator allocator;
guf_libc_alloc_ctx allocator_ctx;
dbuf_char text_buf {};
std::vector<char> text_vec {};
bool load_file(const char *fname);
void free_file();
void insert_lookup(std::optional<ptrdiff_t> inital_dict_cap = {});
};