Freeze the package compatibility corpus: real .rsbank bytes proving both ladder directions, every truncation site, and the round trip
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
// The one accessor over the frozen package-compat corpus (tests/fixtures/package_compat).
|
||||
// REASAMPLER_PACKAGE_FIXTURE_DIR is a compile-time absolute path defined by each
|
||||
// consuming test target: the corpus is source-tree data, and a test's working directory
|
||||
// under ctest differs between single- and multi-config generators, so no relative
|
||||
// spelling reaches it from both.
|
||||
//
|
||||
// Every caller must check the returned size: a fixture that failed to open reads as an
|
||||
// empty buffer, which a "this must be Malformed" assertion would otherwise pass.
|
||||
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
inline std::string packageFixturePath(const std::string& name) {
|
||||
return std::string(REASAMPLER_PACKAGE_FIXTURE_DIR) + "/" + name;
|
||||
}
|
||||
|
||||
inline std::vector<std::uint8_t> packageFixtureBytes(const std::string& name) {
|
||||
std::ifstream f(packageFixturePath(name), std::ios::binary);
|
||||
return std::vector<std::uint8_t>(std::istreambuf_iterator<char>(f),
|
||||
std::istreambuf_iterator<char>());
|
||||
}
|
||||
Reference in New Issue
Block a user