#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 #include #include #include #include inline std::string packageFixturePath(const std::string& name) { return std::string(REASAMPLER_PACKAGE_FIXTURE_DIR) + "/" + name; } inline std::vector packageFixtureBytes(const std::string& name) { std::ifstream f(packageFixturePath(name), std::ios::binary); return std::vector(std::istreambuf_iterator(f), std::istreambuf_iterator()); }