File tree Expand file tree Collapse file tree 3 files changed +39
-18
lines changed Expand file tree Collapse file tree 3 files changed +39
-18
lines changed Original file line number Diff line number Diff line change 1- #include < gtest/gtest.h>
2-
3- #include < fmt/core.h>
4-
1+ #include " util.hpp"
52#include < binsparse/binsparse.hpp>
6-
7- inline std::vector file_paths ({" 1138_bus/1138_bus.mtx" ,
8- " chesapeake/chesapeake.mtx" ,
9- " mouse_gene/mouse_gene.mtx" });
3+ #include < filesystem>
4+ #include < fmt/core.h>
5+ #include < gtest/gtest.h>
106
117TEST (BinsparseReadWrite, COOFormat) {
128 using T = float ;
139 using I = std::size_t ;
1410
1511 std::string binsparse_file = " out.bsp.hdf5" ;
1612
17- for (auto && file_path : file_paths) {
13+ auto base_path = find_prefix (files.front ());
14+
15+ for (auto && file : files) {
16+ auto file_path = base_path + file;
1817 auto x = binsparse::__detail::mmread<
1918 T, I, binsparse::__detail::coo_matrix_owning<T, I>>(file_path);
2019
@@ -46,4 +45,6 @@ TEST(BinsparseReadWrite, COOFormat) {
4645 delete matrix_.rowind ;
4746 delete matrix_.colind ;
4847 }
48+
49+ std::filesystem::remove (binsparse_file);
4950}
Original file line number Diff line number Diff line change 1- #include < gtest/gtest.h>
2-
3- #include < fmt/core.h>
4-
1+ #include " util.hpp"
52#include < binsparse/binsparse.hpp>
6-
7- inline std::vector file_paths ({" 1138_bus/1138_bus.mtx" ,
8- " chesapeake/chesapeake.mtx" ,
9- " mouse_gene/mouse_gene.mtx" });
3+ #include < filesystem>
4+ #include < fmt/core.h>
5+ #include < gtest/gtest.h>
106
117TEST (BinsparseReadWrite, CSRFormat) {
128 using T = float ;
139 using I = std::size_t ;
1410
1511 std::string binsparse_file = " out.bsp.hdf5" ;
1612
17- for (auto && file_path : file_paths) {
13+ auto base_path = find_prefix (files.front ());
14+
15+ for (auto && file : files) {
16+ auto file_path = base_path + file;
1817 auto x = binsparse::__detail::mmread<
1918 T, I, binsparse::__detail::csr_matrix_owning<T, I>>(file_path);
2019
@@ -46,4 +45,6 @@ TEST(BinsparseReadWrite, CSRFormat) {
4645 delete matrix_.row_ptr ;
4746 delete matrix_.colind ;
4847 }
48+
49+ std::filesystem::remove (binsparse_file);
4950}
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include < filesystem>
4+ #include < string>
5+ #include < vector>
6+
7+ inline std::vector<std::string> files ({" data/1138_bus/1138_bus.mtx" ,
8+ " data/chesapeake/chesapeake.mtx" ,
9+ " data/mouse_gene/mouse_gene.mtx" });
10+
11+ inline std::string find_prefix (std::string file_name) {
12+ if (std::filesystem::exists (" ../../" + file_name)) {
13+ return " ../../" ;
14+ } else if (std::filesystem::exists (" build/" + file_name)) {
15+ return " build/" ;
16+ } else {
17+ return " " ;
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments