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

#undef NDEBUG

#include <map>
#include <ox/std/error.hpp>
#include <ox/mc/mc.hpp>
#include <nostalgia/core/core.hpp>

using namespace nostalgia;

static std::map<ox::StringView, ox::Error(*)()> tests = {
	{
		"readWriteTileSheet",
		[]() -> ox::Error {
			core::TileSheet in;
			oxRequire(buff, ox::writeMC(in));
			oxRequire(out, ox::readMC<core::TileSheet>(buff));
			oxAssert(in.subsheet.name == out.subsheet.name, "subsheet.name serialization broken");
			return {};
		}
	},
};

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