|
36 | 36 | #include <unordered_set> |
37 | 37 | #include <vector> |
38 | 38 | #include <cstdio> |
| 39 | +#include <cstdlib> |
39 | 40 | #include <random> |
40 | 41 | #include <parquet/arrow/writer.h> |
41 | 42 | #include <hdf5.h> |
@@ -1842,14 +1843,30 @@ TEST(Xenium, ManifestHelpers) { |
1842 | 1843 | EXPECT_TRUE(baysor::is_xenium_manifest_path("experiment.xenium")); |
1843 | 1844 | EXPECT_FALSE(baysor::is_xenium_manifest_path("transcripts.parquet")); |
1844 | 1845 |
|
1845 | | - const std::filesystem::path dataset_dir = |
1846 | | - std::filesystem::path(BAYSOR_TEST_SOURCE_DIR) / |
1847 | | - "examples/Xenium_pancreas_membrane_377/data"; |
| 1846 | + char tmpl[] = "/tmp/baysor_xenium_manifest_XXXXXX"; |
| 1847 | + char* created = mkdtemp(tmpl); |
| 1848 | + ASSERT_NE(created, nullptr); |
| 1849 | + |
| 1850 | + const std::filesystem::path dataset_dir(created); |
1848 | 1851 | const std::string manifest_path = (dataset_dir / "experiment.xenium").string(); |
| 1852 | + { |
| 1853 | + std::ofstream manifest(manifest_path); |
| 1854 | + ASSERT_TRUE(static_cast<bool>(manifest)); |
| 1855 | + manifest << "{}\n"; |
| 1856 | + } |
| 1857 | + { |
| 1858 | + std::ofstream transcripts((dataset_dir / "transcripts.parquet").string(), std::ios::binary); |
| 1859 | + ASSERT_TRUE(static_cast<bool>(transcripts)); |
| 1860 | + } |
| 1861 | + |
1849 | 1862 | auto ctx = baysor::load_xenium_manifest_context(manifest_path); |
1850 | 1863 | EXPECT_EQ(ctx.manifest_path, manifest_path); |
1851 | 1864 | EXPECT_EQ(ctx.dataset_dir, dataset_dir.string()); |
1852 | 1865 | EXPECT_EQ(ctx.transcripts_path, (dataset_dir / "transcripts.parquet").string()); |
| 1866 | + |
| 1867 | + std::error_code ec; |
| 1868 | + std::filesystem::remove_all(dataset_dir, ec); |
| 1869 | + EXPECT_FALSE(ec) << ec.message(); |
1853 | 1870 | } |
1854 | 1871 |
|
1855 | 1872 | // ============================================================================ |
|
0 commit comments