Skip to content

Commit

Permalink
Updated tests to use the latest tatami.
Browse files Browse the repository at this point in the history
Also turned on all warnings and fixed the associated errors.
  • Loading branch information
LTLA committed Mar 31, 2024
1 parent fc27f36 commit 008f681
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 168 deletions.
13 changes: 7 additions & 6 deletions include/tatami_mtx/load_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix(byteme::Reader& read
* @return Pointer to a `tatami::Matrix` instance containing data from the Matrix Market file.
*/
template<bool row_, typename Data_, typename Index_, bool parallel_ = false, typename StoredData_ = Automatic, typename StoredIndex_ = Automatic>
std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_text_file(const char * filepath, int compression = 0, size_t bufsize = 65536) {
std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_text_file(const char * filepath, size_t bufsize = 65536) {
byteme::RawFileReader reader(filepath, bufsize);
return load_matrix<row_, Data_, Index_, StoredData_, StoredIndex_, parallel_>(reader);
}
Expand Down Expand Up @@ -279,12 +279,11 @@ std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_some_file(const
*
* @param buffer Array containing the contents of an uncompressed Matrix Market file.
* @param n Length of the array.
* @param bufsize Size of the buffer (in bytes) to use when decompressing the file contents.
*
* @return Pointer to a `tatami::Matrix` instance containing data from the Matrix Market file.
*/
template<bool row_, typename Data_, typename Index_, typename StoredData_ = Automatic, typename StoredIndex_ = Automatic, bool parallel_ = false>
std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_text_buffer(const unsigned char * buffer, size_t n, size_t bufsize = 65536) {
std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_text_buffer(const unsigned char * buffer, size_t n) {
byteme::RawBufferReader reader(buffer, n);
return load_matrix<row_, Data_, Index_, StoredData_, StoredIndex_, parallel_>(reader);
}
Expand All @@ -303,13 +302,15 @@ std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_text_buffer(con
*
* @param buffer Array containing the contents of a Matrix Market file after Gzip/Zlib compression.
* @param n Length of the array.
* @param compression Compression of the stream - DEFLATE (0), Zlib (1) or Gzip (2).
* Default of 3 will auto-detect between Zlib and Gzip based on the headers.
* @param bufsize Size of the buffer (in bytes) to use when decompressing the file contents.
*
* @return Pointer to a `tatami::Matrix` instance containing data from the Matrix Market file.
*/
template<bool row_, typename Data_, typename Index_, typename StoredData_ = Automatic, typename StoredIndex_ = Automatic, bool parallel_ = false>
std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_zlib_buffer(const unsigned char * buffer, size_t n, int compression = 0, size_t bufsize = 65536) {
byteme::ZlibBufferReader reader(buffer, n, 3, bufsize);
std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_zlib_buffer(const unsigned char * buffer, size_t n, int compression = 3, size_t bufsize = 65536) {
byteme::ZlibBufferReader reader(buffer, n, compression, bufsize);
return load_matrix<row_, Data_, Index_, StoredData_, StoredIndex_, parallel_>(reader);
}

Expand All @@ -331,7 +332,7 @@ std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_zlib_buffer(con
*/
template<bool row_, typename Data_, typename Index_, typename StoredData_ = Automatic, typename StoredIndex_ = Automatic, bool parallel_ = false>
std::shared_ptr<tatami::Matrix<Data_, Index_> > load_matrix_from_some_buffer(const unsigned char * buffer, size_t n, size_t bufsize = 65536) {
byteme::SomeBufferReader reader(buffer, n);
byteme::SomeBufferReader reader(buffer, n, bufsize);
return load_matrix<row_, Data_, Index_, StoredData_, StoredIndex_, parallel_>(reader);
}

Expand Down
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ if (NOT HAVE_CXX_FS)
target_link_libraries(libtest stdc++fs)
endif()

target_compile_options(libtest PRIVATE -Wall -Wextra -Wpedantic -Werror)

set(CODE_COVERAGE OFF CACHE BOOL "Enable coverage testing")
if(CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(libtest PRIVATE -O0 -g --coverage)
Expand Down
Loading

0 comments on commit 008f681

Please sign in to comment.