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"
5
2
#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>
10
6
11
7
TEST (BinsparseReadWrite, COOFormat) {
12
8
using T = float ;
13
9
using I = std::size_t ;
14
10
15
11
std::string binsparse_file = " out.bsp.hdf5" ;
16
12
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;
18
17
auto x = binsparse::__detail::mmread<
19
18
T, I, binsparse::__detail::coo_matrix_owning<T, I>>(file_path);
20
19
@@ -46,4 +45,6 @@ TEST(BinsparseReadWrite, COOFormat) {
46
45
delete matrix_.rowind ;
47
46
delete matrix_.colind ;
48
47
}
48
+
49
+ std::filesystem::remove (binsparse_file);
49
50
}
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"
5
2
#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>
10
6
11
7
TEST (BinsparseReadWrite, CSRFormat) {
12
8
using T = float ;
13
9
using I = std::size_t ;
14
10
15
11
std::string binsparse_file = " out.bsp.hdf5" ;
16
12
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;
18
17
auto x = binsparse::__detail::mmread<
19
18
T, I, binsparse::__detail::csr_matrix_owning<T, I>>(file_path);
20
19
@@ -46,4 +45,6 @@ TEST(BinsparseReadWrite, CSRFormat) {
46
45
delete matrix_.row_ptr ;
47
46
delete matrix_.colind ;
48
47
}
48
+
49
+ std::filesystem::remove (binsparse_file);
49
50
}
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