/*
 * Copyright 2016 - 2025 Gary Talent (gary@drinkingtea.net). All rights reserved.
 */

#undef NDEBUG

#include <map>
#include <ox/std/std.hpp>

#include <keel/keel.hpp>

static std::map<ox::StringView, ox::Error(*)()> tests = {
	{
		"writeUuidHeader",
		[]() -> ox::Error {
			constexpr ox::StringView uuidStr = "8d814442-f46e-4cc3-8edc-ca3c01cc86db";
			constexpr ox::StringView hdr = "K1;8d814442-f46e-4cc3-8edc-ca3c01cc86db;";
			OX_REQUIRE(uuid, ox::UUID::fromString(uuidStr));
			ox::Array<char, hdr.size()> buff;
			ox::CharBuffWriter bw(buff);
			OX_RETURN_ERROR(keel::writeUuidHeader(bw, uuid));
			ox::expect(ox::StringView(buff.data(), buff.size()), hdr);
			return {};
		}
	},
};

int main(int const argc, char const **argv) {
	int retval = -1;
	if (argc > 0) {
		auto const args = ox::Span{argv, static_cast<size_t>(argc)};
		auto testName = args[1];
		if (tests.find(testName) != tests.end()) {
			retval = static_cast<int>(tests[testName]());
		} else {
			retval = 1;
		}
	}
	return retval;
}
