Something went wrong. Try again.
[Mirror] Libreopolis is a cross-platform city simulation game fully compatible with SimCity 2000. gitlab.com/conasg/libreopolis
Something went wrong. Try again.
12345678910111213141516171819202122232425#include <cstdint>#include <cstdio>#include <vector>
#include "sc2k/io/format_probe.hpp"
int main() { using namespace sc2k::io; int failures = 0;#define CHECK(expr) \ do { \ if (!(expr)) { \ std::fprintf(stderr, "FAIL: %s (line %d)\n", #expr, __LINE__); \ ++failures; \ } \ } while (0) std::vector<std::uint8_t> native(kNativeMagic.begin(), kNativeMagic.end()); CHECK(probe_format(native).format == PersistedFormat::Native); const std::vector<std::uint8_t> classic = {'F', 'O', 'R', 'M', 0, 0, 0, 4, 'S', 'C', 'D', 'H'}; CHECK(probe_format(classic).format == PersistedFormat::Classic); CHECK(!probe_format(std::vector<std::uint8_t>{'N', 'O', 'P', 'E'}).ok()); if (failures == 0) std::puts("format_probe: signature checks passed"); return failures == 0 ? 0 : 1;}