test(tests): added test suite

The test suite is extensive. Note that LLMs were used to aid in the development of the test suite. All LLM generated code was manually reviewed.
This commit is contained in:
2026-11-09 13:53:17 -05:00
parent 74e55a6859
commit cb20faeb3d
202 changed files with 35505 additions and 953 deletions

View File

@@ -0,0 +1,27 @@
#include <filesystem>
#include <limits>
#include <print>
#include "serif/utils/serialize/archive.hpp"
/** @brief Produce independent C++ fixtures for the dependency-free Python data reader. */
int main(int argc, char** argv) {
namespace serialization = serif::utils::serialize;
if (argc != 2) {
return 2;
}
const auto contents = serialization::pack(serialization::named("values", std::vector<double>{-0.0, 1.2345678901234567,
std::numeric_limits<double>::denorm_min(), std::numeric_limits<double>::infinity(),
std::bit_cast<double>(0x7ff8123456789abcULL)}), serialization::named("empty", std::vector<double>{}),
serialization::named("integers", std::vector<std::int64_t>{std::numeric_limits<std::int64_t>::min(), std::numeric_limits<std::int64_t>::max()}),
serialization::named("label", std::string{"ξ\n\"quote\"\\end"}));
for (serialization::Format format : {serialization::Format::binary, serialization::Format::text}) {
const auto path = std::filesystem::path{argv[1]} / (format == serialization::Format::binary ? "binary.serif" : "text.serif");
const auto result = serialization::write(path, contents, {.format = format, .author = "Cross-language regression"});
if (!result) {
std::println(stderr, "{}: {}", result.error().path, result.error().message);
return 1;
}
}
return 0;
}